java.lang.Object
org.bouncycastle.pqc.crypto.mlkem.CBD

final class CBDextends Object
Central Binomial Distribution (CBD) sampling for ML-KEM operations. Provides polynomial coefficient sampling from binomial distribution for noise generation.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    CBD()
    unused
  • Method Summary

    Modifier and Type
    Method
    Description
    private static long
    convertByteTo24BitUnsignedInt(byte[] x, int offset)
    Converts an Array of Bytes to a 24-bit Unsigned Integer Returns a 24-bit unsigned integer as a long from byte x
    private static long
    convertByteTo32BitUnsignedInt(byte[] x, int offset)
    Converts an Array of Bytes to a 32-bit Unsigned Integer Returns a 32-bit unsigned integer as a long
    static void
    mlkemCBD(Poly r, byte[] bytes, int eta)
    Perform ML-KEM CBD sampling.

    Methods inherited from class Object

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

    • CBD

      private CBD()
      unused
  • Method Details

    • mlkemCBD

      public static void mlkemCBD(Poly r, byte[] bytes, int eta)
      Perform ML-KEM CBD sampling.
      Parameters:
      r - the output polynomial
      bytes - the input byte array
      eta - the CBD parameter (2 or 3)
    • convertByteTo32BitUnsignedInt

      private static long convertByteTo32BitUnsignedInt(byte[] x, int offset)
      Converts an Array of Bytes to a 32-bit Unsigned Integer Returns a 32-bit unsigned integer as a long
      Parameters:
      x - the byte array to convert
      offset - the index of the first byte to convert
      Returns:
      the converted 32-bit unsigned integer as a long
    • convertByteTo24BitUnsignedInt

      private static long convertByteTo24BitUnsignedInt(byte[] x, int offset)
      Converts an Array of Bytes to a 24-bit Unsigned Integer Returns a 24-bit unsigned integer as a long from byte x
      Parameters:
      x - the byte array to convert
      offset - the index of the first byte to convert
      Returns:
      the converted 24-bit unsigned integer as a long