java.lang.Object
org.bouncycastle.pqc.legacy.crypto.gmss.util.GMSSUtil

public class GMSSUtil extends Object
This class provides several methods that are required by the GMSS classes.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    bytesToIntLittleEndian(byte[] bytes)
    Converts a byte array beginning at offset into a 32 bit integer (little-endian representation)
    int
    bytesToIntLittleEndian(byte[] bytes, int offset)
    Converts a byte array beginning at offset 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 array
    int
    getLog(int intValue)
    This method returns the least integer that is greater or equal to the logarithm to the base 2 of an integer intValue.
    byte[]
    Converts a 32 bit integer into a byte array beginning at offset (little-endian representation)
    void
    printArray(String text, byte[] array)
    This method prints the values of a 1-dimensional byte array
    void
    printArray(String text, byte[][] array)
    This method prints the values of a 2-dimensional byte array
    boolean
    testPowerOfTwo(int testValue)
    This method tests if an integer is a power of 2.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GMSSUtil

      public GMSSUtil()
  • Method Details

    • intToBytesLittleEndian

      public byte[] intToBytesLittleEndian(int value)
      Converts a 32 bit integer into a byte array beginning at offset (little-endian representation)
      Parameters:
      value - the integer to convert
    • bytesToIntLittleEndian

      public int bytesToIntLittleEndian(byte[] bytes)
      Converts a byte array beginning at offset 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 at offset into a 32 bit integer (little-endian representation)
      Parameters:
      bytes - the byte array
      offset - 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

      public void printArray(String text, byte[][] array)
      This method prints the values of a 2-dimensional byte array
      Parameters:
      text - a String
      array - a 2-dimensional byte array
    • printArray

      public void printArray(String text, byte[] array)
      This method prints the values of a 1-dimensional byte array
      Parameters:
      text - a String
      array - 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 if testValue 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 integer intValue.
      Parameters:
      intValue - an integer
      Returns:
      The least integer greater or equal to the logarithm to the base 2 of intValue