Class BigIntUtils


  • public final class BigIntUtils
    extends java.lang.Object
    FIXME: is this really necessary?!
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean equals​(java.math.BigInteger[] a, java.math.BigInteger[] b)
      Checks if two BigInteger arrays contain the same entries
      static void fill​(java.math.BigInteger[] array, java.math.BigInteger value)
      Fill the given BigInteger array with the given value.
      static java.math.BigInteger[] subArray​(java.math.BigInteger[] input, int start, int end)
      Generates a subarray of a given BigInteger array.
      static int[] toIntArray​(java.math.BigInteger[] input)
      Converts a BigInteger array into an integer array
      static int[] toIntArrayModQ​(int q, java.math.BigInteger[] input)
      Converts a BigInteger array into an integer array, reducing all BigIntegers mod q.
      static byte[] toMinimalByteArray​(java.math.BigInteger value)
      Return the value of big as a byte array.
      • Methods inherited from class java.lang.Object

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

      • equals

        public static boolean equals​(java.math.BigInteger[] a,
                                     java.math.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​(java.math.BigInteger[] array,
                                java.math.BigInteger value)
        Fill the given BigInteger array with the given value.
        Parameters:
        array - the array
        value - the value
      • subArray

        public static java.math.BigInteger[] subArray​(java.math.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​(java.math.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,
                                           java.math.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​(java.math.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