Skip to main content

compute_credential_commitment

Function compute_credential_commitment 

Source
pub fn compute_credential_commitment(
    attributes: &[Vec<u8>],
) -> Result<Vec<u8>, Error>
Expand description

Compute the credential commitment from all attributes.

This produces the same commitment that the prover embeds in the proof, allowing a verifier (or issuer) to derive expected_commitment from the full attribute set without needing the proof itself.

The commitment is computed by Poseidon-hashing each attribute individually, then aggregating all per-attribute hashes via an iterated Poseidon chain.

Returns 8 bytes: 4 LE bytes for the real part, 4 LE bytes for the imaginary part of the Complex<Mersenne31> commitment field element. Pass these bytes to verify_credential_proof as expected_commitment.