Class Argon2idPasswordHasher

Assembly: redb.Identity.Core.dll

C12: Argon2id password hasher — OWASP 2023+ recommended primary algorithm.

Encoded hash format (PHC string, compatible with libargon2 / other implementations):
$argon2id$v=19$m={memoryKb},t={iterations},p={parallelism}$<base64-salt>$<base64-hash>.
Base64 is unpadded (RFC 7693 §3.5) to match the de-facto PHC format.


Defaults: memory=65536 KiB (64 MiB), iterations=3, parallelism=4, salt=16 bytes, hash=32 bytes.
At these parameters a single verify takes ~50–150 ms on a modern desktop CPU.

public sealed class Argon2idPasswordHasher : IPasswordHasher

Inheritance

Object→Argon2idPasswordHasher

Implements

Properties

Iterations

Iterations (time cost) used for new hashes.

public int Iterations { get; }

MemoryKib

Memory cost in KiB used for new hashes.

public int MemoryKib { get; }

Parallelism

Degree of parallelism (lanes) used for new hashes.

public int Parallelism { get; }

Methods

HashPassword(string)

Hash a plain-text password.

public string HashPassword(string password)

NeedsRehash(string)

Returns true when the stored hash's parameters are weaker than the hasher's current settings

public bool NeedsRehash(string hashedPassword)

VerifyPassword(string, string)

Verify a password against a hash.

public bool VerifyPassword(string password, string hashedPassword)

Constructors

Argon2idPasswordHasher(int, int, int, int, int, ILogger<Argon2idPasswordHasher>?)

Creates an Argon2id hasher with OWASP 2023 parameters by default.