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
frombytes
to a field element - encode_
as_ field_ elements_ full - Converts each chunk of size
F::size_in_bytes()
frombytes
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)