For the complete documentation index, see llms.txt.
aztec-nr - protocol_types::hash

Function poseidon2_hash_bytes

pub fn poseidon2_hash_bytes<let N: u32>(inputs: [u8; N]) -> Field

Computes a Poseidon2 hash of a fixed string, such as a function signature or a domain separator name.

The bytes are packed into 31-byte little-endian chunks, one Field per chunk, and the result is poseidon2_hash of those fields.

The hash commits to the number of chunks but not to the byte length N: zero bytes at the end of the last chunk do not change the result, so [1], [1, 0] and [1, 0, ..., 0] (31 bytes) all hash to the same value. Do not use this to commit to variable-length data, e.g. a payload zero-padded to a maximum length, unless the length is bound separately.