Skip to main content

hash_auth_message

Function hash_auth_message 

Source
pub fn hash_auth_message(message: &str) -> Result<[u8; 40], AuthTokenError>
Expand description

Hash the auth-token ASCII message to its 40-byte Fp5 digest.

Splits the bytes into 8-byte little-endian Goldilocks limbs (zero-padding the trailing chunk) and runs hash_to_quintic_extension over the limbs. Returns the canonical 40-byte little-endian encoding the Schnorr binding signs over.

ยงErrors

Returns AuthTokenError::MessageEncoding if any 8-byte chunk decodes to a non-canonical Goldilocks element. The auth-token format is ASCII ('0'..='9' and ':'), so every byte sits in 0..=0x3A and the case is unreachable for tokens emitted by auth_token_message; the error path exists for callers that pass arbitrary preimages.