Module encoding

Source
Expand description

This file handles bytes <-> scalar conversions for Saffron. Unless specified in the function’s name, conversions are made over F::MODULUS_BIT_SIZE / 8 bytes (31 bytes for Pallas & Vesta). Functions that convert over F::size_in_bytes() are suffixed with _full (this size is 32 bytes for Pallas & Vesta fields elements)

Functions§

decode_from_field_elements
Creates a bytes vector that represents each element of xs over 31 bytes
encode
Converts bytes into a field element ; bytes length can be arbitrary.
encode_as_field_elements
Converts each chunk of size F::MODULUS_BIT_SIZE / 8 from bytes to a field element
encode_as_field_elements_full
Converts each chunk of size F::size_in_bytes() from bytes to a field element
encode_for_domain
Same as encode_as_field_elements, but the returned vector is divided in chunks of domain_size (except for the last chunk if its size is smaller)