Class MultiFormatPasswordHasher
C12: dispatching password hasher that produces new hashes with the configured primary
algorithm (Argon2id by default) while remaining able to verify and transparently migrate
legacy hashes (BCrypt, legacy SHA256+salt, and — via any fallback
supplied as legacyVerifier — PBKDF2 or other formats).
On successful verification of a legacy hash, callers should check
and, if true, re-hash the plaintext with and persist the new hash.
This is the standard OWASP "upgrade-on-login" pattern.
public sealed class MultiFormatPasswordHasher : IPasswordHasher
Inheritance
Implements
Methods
NeedsRehash(string)
Returns true when the stored hash is not produced by the primary algorithm at the
public bool NeedsRehash(string hashedPassword)
VerifyPassword(string, string)
Verify a password against a hash.
public bool VerifyPassword(string password, string hashedPassword)
Constructors
MultiFormatPasswordHasher(Argon2idPasswordHasher, BcryptPasswordHasher, IPasswordHasher?)
Creates a multi-format hasher.