Class BigIntUtils


  • public final class BigIntUtils
    extends Object
    FIXME: is this really necessary?!
    • Method Detail

      • equals

        public static boolean equals​(BigInteger[] a,
                                     BigInteger[] b)
        Checks if two BigInteger arrays contain the same entries
        Parameters:
        a - first BigInteger array
        b - second BigInteger array
        Returns:
        true or false
      • fill

        public static void fill​(BigInteger[] array,
                                BigInteger value)
        Fill the given BigInteger array with the given value.
        Parameters:
        array - the array
        value - the value
      • subArray

        public static BigInteger[] subArray​(BigInteger[] input,
                                            int start,
                                            int end)
        Generates a subarray of a given BigInteger array.
        Parameters:
        input - - the input BigInteger array
        start - - the start index
        end - - the end index
        Returns:
        a subarray of input, ranging from start to end
      • toIntArray

        public static int[] toIntArray​(BigInteger[] input)
        Converts a BigInteger array into an integer array
        Parameters:
        input - - the BigInteger array
        Returns:
        the integer array
      • toIntArrayModQ

        public static int[] toIntArrayModQ​(int q,
                                           BigInteger[] input)
        Converts a BigInteger array into an integer array, reducing all BigIntegers mod q.
        Parameters:
        q - - the modulus
        input - - the BigInteger array
        Returns:
        the integer array
      • toMinimalByteArray

        public static byte[] toMinimalByteArray​(BigInteger value)
        Return the value of big as a byte array. Although BigInteger has such a method, it uses an extra bit to indicate the sign of the number. For elliptic curve cryptography, the numbers usually are positive. Thus, this helper method returns a byte array of minimal length, ignoring the sign of the number.
        Parameters:
        value - the BigInteger value to be converted to a byte array
        Returns:
        the value big as byte array