de.flexiprovider.common.util
Class FlexiBigIntUtils

java.lang.Object
  |
  +--de.flexiprovider.common.util.FlexiBigIntUtils

public final class FlexiBigIntUtils
extends java.lang.Object


Method Summary
static boolean equals(FlexiBigInt[] a, FlexiBigInt[] b)
          Checks if two FlexiBigInt arrays contain the same entries
static void fill(FlexiBigInt[] array, FlexiBigInt value)
          Fill the given FlexiBigInt array with the given value.
static FlexiBigInt[] subArray(FlexiBigInt[] input, int start, int end)
          Generates a subarray of a given FlexiBigInt array.
static int[] toIntArray(FlexiBigInt[] input)
          Converts a FlexiBigInt array into an integer array
static int[] toIntArrayModQ(int q, FlexiBigInt[] input)
          Converts a FlexiBigInt array into an integer array, reducing all FlexiBigInts mod q.
static byte[] toMinimalByteArray(FlexiBigInt 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(FlexiBigInt[] a,
                             FlexiBigInt[] b)
Checks if two FlexiBigInt arrays contain the same entries
Parameters:
a - first FlexiBigInt array
b - second FlexiBigInt array
Returns:
true or false

fill

public static void fill(FlexiBigInt[] array,
                        FlexiBigInt value)
Fill the given FlexiBigInt array with the given value.
Parameters:
array - the array
value - the value

subArray

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

toIntArray

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

toIntArrayModQ

public static int[] toIntArrayModQ(int q,
                                   FlexiBigInt[] input)
Converts a FlexiBigInt array into an integer array, reducing all FlexiBigInts mod q.
Parameters:
q - - the modulus
input - - the FlexiBigInt array
Returns:
the integer array

toMinimalByteArray

public static byte[] toMinimalByteArray(FlexiBigInt value)
Return the value of big as a byte array. Although FlexiBigInt 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 FlexiBigInt value to be converted to a byte array
Returns:
the value big as byte array