Skip to main content

Module aux_functions

Module aux_functions 

Source
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.