Skip to main content

decode_phc

Function decode_phc 

Source
pub fn decode_phc(
    encoded: &str,
) -> Result<(Params, Vec<u8>, Vec<u8>), Argon2Error>
Expand description

Decode an Argon2id PHC string format into (params, salt, tag).

Expected format: $argon2id$v=19$m=<m>,t=<t>,p=<p>$<salt_b64>$<hash_b64>

ยงErrors

Returns Argon2Error::InvalidEncoding for a malformed string, and Argon2Error::InvalidParams if the decoded parameters violate the RFC 9106 bounds (t >= 1, p in 1..=2^24 - 1, m >= 8*p) or if the decoded tag is shorter than 4 bytes. Note that the salt is not validated.