aztec-nr - noir_aztec::utils::conversion::bytes_to_fields

Function bytes_from_fields

pub fn bytes_from_fields<let N: u32>(
    fields: BoundedVec<Field, N>,
) -> BoundedVec<u8, N * 31>

Converts an input BoundedVec of fields into a BoundedVec of bytes in big-endian order. Arbitrary Field arrays are not allowed: this is assumed to be an array obtained via bytes_to_fields, i.e. one that actually represents bytes. To convert a Field array into bytes, use fields_to_bytes.

Each input field must contain at most 31 bytes (this is constrained to be so). Each field is converted into 31 big-endian bytes, and the resulting 31-byte chunks are concatenated back together in the order of the original fields.