padded_elements_to_bytes

Function padded_elements_to_bytes 

Source
pub fn padded_elements_to_bytes(felts: &[BaseElement]) -> Option<Vec<u8>>
Expand description

Converts a sequence of padded field elements back to the original bytes.

Reconstructs the original byte sequence by removing the padding added by bytes_to_felts. The padding consists of a 1 bit followed by zeros in the final field element.

Note that by the endianness of the conversion as well as the fact that we are packing at most 56 = 7 * 8 bits in each field element, the padding above with 1 should never overflow the field size.

§Arguments

  • felts - Slice of field elements with padding in the last element

§Returns

  • Some(Vec<u8>) - The original byte sequence with padding removed
  • None - If no padding marker (1 bit) is found