Interface: PasswordHashMetadata
Structured representation of a PHC-formatted Argon2id hash string. Useful for inspecting hash strength, performing migrations, or validating formats.
Fields:
algorithm: Always'argon2id'for this implementation.params: Parsed Argon2Params showing the effective security level.salt: Raw salt bytes (16 bytes by default).hash: Raw digest bytes (length =params.tagLength).
Edge cases:
- parseArgon2idHash returns
nullfor invalid or non-argon2id hashes; always null-check before accessing fields. - Tag length is inferred from the digest length and may differ from the original parameter if tampered with.
Example
const metadata = parseArgon2idHash(storedHash)
if (metadata && metadata.params.memorySize < 4096) {
console.warn('Legacy hash detected')
}
See
- parseArgon2idHash
- needsRehash
Properties
algorithm
algorithm: "argon2id";
hash
hash: Uint8Array;
params
params: Argon2Params;
salt
salt: Uint8Array;