Expand description
Implements auxiliary functions for ML-DSA as defined in Section 7 of FIPS 204.
Functionsยง
- byte_
decode - Algorithm 6 ByteDecode_d(๐ต) Decodes a byte array into an array of ๐-bit integers for 1 โค ๐ โค 12. Input: byte array ๐ต โ ๐น32๐ . Output: integer array ๐น โ โค256 , where ๐ = 2๐ if ๐ < 12 and ๐ = ๐ if ๐ = 12. Note: this is exposed publicly only for testing purposes and there is no good reason to use it in production code.
- byte_
encode - Algorithm 5 ByteEncode_d(๐น) Encodes an array of ๐-bit integers into a byte array for 1 โค ๐ โค 12. Input: integer array ๐น โ โค_M^256, where ๐ = 2^๐ if ๐ < 12, and ๐ = ๐ if ๐ = 12. Output: byte array ๐ต โ ๐น32๐. Note: this is exposed publicly only for testing purposes and there is no good reason to use it in production code.
- sample_
ntt - Algorithm 7 SampleNTT(๐ต) Takes a 32-byte seed and two indices as input and outputs a pseudorandom element of ๐๐. Input: byte array ๐ต โ ๐น34 . โท a 32-byte seed along with two indices Output: array ๐_hat โ โค256 โท the coefficients of the NTT of a polynomial Note: this is exposed publicly only for testing purposes and there is no good reason to use it in production code.
- sample_
poly_ cbd - Algorithm 8 SamplePolyCBD (๐ต)๐ Takes a seed as input and outputs a pseudorandom sample from the distribution D๐(๐ ๐). Input: byte array ๐ต โ ๐น64๐. Output: array ๐ โ โค256 โท the coefficients of the sampled polynomial Note: this is exposed publicly only for testing purposes and there is no good reason to use it in production code.