java.lang.Object
org.bouncycastle.pqc.legacy.math.linearalgebra.ByteUtils

public final class ByteUtils extends Object
Deprecated.
use org.bouncycastle.util.Arrays.
This class is a utility class for manipulating byte arrays.
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    clone(byte[] array)
    Deprecated.
    Return a clone of the given byte array (performs null check beforehand).
    static byte[]
    concatenate(byte[][] array)
    Deprecated.
    Convert a 2-dimensional byte array into a 1-dimensional byte array by concatenating all entries.
    static byte[]
    concatenate(byte[] x1, byte[] x2)
    Deprecated.
    Concatenate two byte arrays.
    static int
    deepHashCode(byte[] array)
    Deprecated.
    Computes a hashcode based on the contents of a one-dimensional byte array rather than its identity.
    static int
    deepHashCode(byte[][] array)
    Deprecated.
    Computes a hashcode based on the contents of a two-dimensional byte array rather than its identity.
    static int
    deepHashCode(byte[][][] array)
    Deprecated.
    Computes a hashcode based on the contents of a three-dimensional byte array rather than its identity.
    static boolean
    equals(byte[][][] left, byte[][][] right)
    Deprecated.
    Compare two three-dimensional byte arrays.
    static boolean
    equals(byte[][] left, byte[][] right)
    Deprecated.
    Compare two two-dimensional byte arrays.
    static boolean
    equals(byte[] left, byte[] right)
    Deprecated.
    Compare two byte arrays (perform null checks beforehand).
    static byte[]
    Deprecated.
    Convert a string containing hexadecimal characters to a byte-array.
    static byte[][]
    split(byte[] input, int index)
    Deprecated.
    Split a byte array input into two arrays at index, i.e.
    static byte[]
    subArray(byte[] input, int start)
    Deprecated.
    Generate a subarray of a given byte array.
    static byte[]
    subArray(byte[] input, int start, int end)
    Deprecated.
    Generate a subarray of a given byte array.
    static String
    toBinaryString(byte[] input)
    Deprecated.
    Convert a byte array to the corresponding bit string.
    static char[]
    toCharArray(byte[] input)
    Deprecated.
    Rewrite a byte array as a char array
    static String
    toHexString(byte[] input)
    Deprecated.
    Convert a byte array to the corresponding hexstring.
    static String
    toHexString(byte[] input, String prefix, String seperator)
    Deprecated.
    Convert a byte array to the corresponding hex string.
    static byte[]
    xor(byte[] x1, byte[] x2)
    Deprecated.
    Compute the bitwise XOR of two arrays of bytes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • equals

      public static boolean equals(byte[] left, byte[] right)
      Deprecated.
      Compare two byte arrays (perform null checks beforehand).
      Parameters:
      left - the first byte array
      right - the second byte array
      Returns:
      the result of the comparison
    • equals

      public static boolean equals(byte[][] left, byte[][] right)
      Deprecated.
      Compare two two-dimensional byte arrays. No null checks are performed.
      Parameters:
      left - the first byte array
      right - the second byte array
      Returns:
      the result of the comparison
    • equals

      public static boolean equals(byte[][][] left, byte[][][] right)
      Deprecated.
      Compare two three-dimensional byte arrays. No null checks are performed.
      Parameters:
      left - the first byte array
      right - the second byte array
      Returns:
      the result of the comparison
    • deepHashCode

      public static int deepHashCode(byte[] array)
      Deprecated.
      Computes a hashcode based on the contents of a one-dimensional byte array rather than its identity.
      Parameters:
      array - the array to compute the hashcode of
      Returns:
      the hashcode
    • deepHashCode

      public static int deepHashCode(byte[][] array)
      Deprecated.
      Computes a hashcode based on the contents of a two-dimensional byte array rather than its identity.
      Parameters:
      array - the array to compute the hashcode of
      Returns:
      the hashcode
    • deepHashCode

      public static int deepHashCode(byte[][][] array)
      Deprecated.
      Computes a hashcode based on the contents of a three-dimensional byte array rather than its identity.
      Parameters:
      array - the array to compute the hashcode of
      Returns:
      the hashcode
    • clone

      public static byte[] clone(byte[] array)
      Deprecated.
      Return a clone of the given byte array (performs null check beforehand).
      Parameters:
      array - the array to clone
      Returns:
      the clone of the given array, or null if the array is null
    • fromHexString

      public static byte[] fromHexString(String s)
      Deprecated.
      Convert a string containing hexadecimal characters to a byte-array.
      Parameters:
      s - a hex string
      Returns:
      a byte array with the corresponding value
    • toHexString

      public static String toHexString(byte[] input)
      Deprecated.
      Convert a byte array to the corresponding hexstring.
      Parameters:
      input - the byte array to be converted
      Returns:
      the corresponding hexstring
    • toHexString

      public static String toHexString(byte[] input, String prefix, String seperator)
      Deprecated.
      Convert a byte array to the corresponding hex string.
      Parameters:
      input - the byte array to be converted
      prefix - the prefix to put at the beginning of the hex string
      seperator - a separator string
      Returns:
      the corresponding hex string
    • toBinaryString

      public static String toBinaryString(byte[] input)
      Deprecated.
      Convert a byte array to the corresponding bit string.
      Parameters:
      input - the byte array to be converted
      Returns:
      the corresponding bit string
    • xor

      public static byte[] xor(byte[] x1, byte[] x2)
      Deprecated.
      Compute the bitwise XOR of two arrays of bytes. The arrays have to be of same length. No length checking is performed.
      Parameters:
      x1 - the first array
      x2 - the second array
      Returns:
      x1 XOR x2
    • concatenate

      public static byte[] concatenate(byte[] x1, byte[] x2)
      Deprecated.
      Concatenate two byte arrays. No null checks are performed.
      Parameters:
      x1 - the first array
      x2 - the second array
      Returns:
      (x2 | | x1) (little-endian order, i.e. x1 is at lower memory addresses)
    • concatenate

      public static byte[] concatenate(byte[][] array)
      Deprecated.
      Convert a 2-dimensional byte array into a 1-dimensional byte array by concatenating all entries.
      Parameters:
      array - a 2-dimensional byte array
      Returns:
      the concatenated input array
    • split

      public static byte[][] split(byte[] input, int index) throws ArrayIndexOutOfBoundsException
      Deprecated.
      Split a byte array input into two arrays at index, i.e. the first array will have the lower index bytes, the second one the higher input.length - index bytes.
      Parameters:
      input - the byte array to be split
      index - the index where the byte array is split
      Returns:
      the splitted input array as an array of two byte arrays
      Throws:
      ArrayIndexOutOfBoundsException - if index is out of bounds
    • subArray

      public static byte[] subArray(byte[] input, int start, int end)
      Deprecated.
      Generate a subarray of a given byte array.
      Parameters:
      input - the input byte array
      start - the start index
      end - the end index
      Returns:
      a subarray of input, ranging from start (inclusively) to end (exclusively)
    • subArray

      public static byte[] subArray(byte[] input, int start)
      Deprecated.
      Generate a subarray of a given byte array.
      Parameters:
      input - the input byte array
      start - the start index
      Returns:
      a subarray of input, ranging from start to the end of the array
    • toCharArray

      public static char[] toCharArray(byte[] input)
      Deprecated.
      Rewrite a byte array as a char array
      Parameters:
      input - - the byte array
      Returns:
      char array