Class BigIntUtils
- java.lang.Object
-
- org.bouncycastle.pqc.math.linearalgebra.BigIntUtils
-
public final class BigIntUtils extends java.lang.ObjectFIXME: is this really necessary?!
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanequals(java.math.BigInteger[] a, java.math.BigInteger[] b)Checks if two BigInteger arrays contain the same entriesstatic voidfill(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 arraystatic 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.
-
-
-
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 arrayb- 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 arrayvalue- 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 arraystart- - the start indexend- - 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 modulusinput- - 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
-
-