Skip to main content

buffer_as_fields

Function buffer_as_fields 

Source
pub fn buffer_as_fields(
    input: &[u8],
    target_length: usize,
) -> Result<Vec<Fr>, Error>
Expand description

Split a byte buffer into field elements for on-chain storage.

The first field stores the buffer length. Subsequent fields each hold up to 31 bytes, left-aligned at byte 1 in a 32-byte field (byte 0 is zero). The output is zero-padded to target_length.