Class GMSSUtil
java.lang.Object
org.bouncycastle.pqc.legacy.crypto.gmss.util.GMSSUtil
This class provides several methods that are required by the GMSS classes.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
bytesToIntLittleEndian
(byte[] bytes) Converts a byte array beginning atoffset
into a 32 bit integer (little-endian representation)int
bytesToIntLittleEndian
(byte[] bytes, int offset) Converts a byte array beginning atoffset
into a 32 bit integer (little-endian representation)byte[]
concatenateArray
(byte[][] arraycp) This method concatenates a 2-dimensional byte array into a 1-dimensional byte arrayint
getLog
(int intValue) This method returns the least integer that is greater or equal to the logarithm to the base 2 of an integerintValue
.byte[]
intToBytesLittleEndian
(int value) Converts a 32 bit integer into a byte array beginning atoffset
(little-endian representation)void
printArray
(String text, byte[] array) This method prints the values of a 1-dimensional byte arrayvoid
printArray
(String text, byte[][] array) This method prints the values of a 2-dimensional byte arrayboolean
testPowerOfTwo
(int testValue) This method tests if an integer is a power of 2.
-
Constructor Details
-
GMSSUtil
public GMSSUtil()
-
-
Method Details
-
intToBytesLittleEndian
public byte[] intToBytesLittleEndian(int value) Converts a 32 bit integer into a byte array beginning atoffset
(little-endian representation)- Parameters:
value
- the integer to convert
-
bytesToIntLittleEndian
public int bytesToIntLittleEndian(byte[] bytes) Converts a byte array beginning atoffset
into a 32 bit integer (little-endian representation)- Parameters:
bytes
- the byte array- Returns:
- The resulting integer
-
bytesToIntLittleEndian
public int bytesToIntLittleEndian(byte[] bytes, int offset) Converts a byte array beginning atoffset
into a 32 bit integer (little-endian representation)- Parameters:
bytes
- the byte arrayoffset
- the integer offset into the byte array- Returns:
- The resulting integer
-
concatenateArray
public byte[] concatenateArray(byte[][] arraycp) This method concatenates a 2-dimensional byte array into a 1-dimensional byte array- Parameters:
arraycp
- a 2-dimensional byte array.- Returns:
- 1-dimensional byte array with concatenated input array
-
printArray
This method prints the values of a 2-dimensional byte array- Parameters:
text
- a Stringarray
- a 2-dimensional byte array
-
printArray
This method prints the values of a 1-dimensional byte array- Parameters:
text
- a Stringarray
- a 1-dimensional byte array.
-
testPowerOfTwo
public boolean testPowerOfTwo(int testValue) This method tests if an integer is a power of 2.- Parameters:
testValue
- an integer- Returns:
TRUE
iftestValue
is a power of 2,FALSE
otherwise
-
getLog
public int getLog(int intValue) This method returns the least integer that is greater or equal to the logarithm to the base 2 of an integerintValue
.- Parameters:
intValue
- an integer- Returns:
- The least integer greater or equal to the logarithm to the base 2
of
intValue
-