Soenneker.Hashing.Argon2
4.0.824
Prefix Reserved
dotnet add package Soenneker.Hashing.Argon2 --version 4.0.824
NuGet\Install-Package Soenneker.Hashing.Argon2 -Version 4.0.824
<PackageReference Include="Soenneker.Hashing.Argon2" Version="4.0.824" />
<PackageVersion Include="Soenneker.Hashing.Argon2" Version="4.0.824" />
<PackageReference Include="Soenneker.Hashing.Argon2" />
paket add Soenneker.Hashing.Argon2 --version 4.0.824
#r "nuget: Soenneker.Hashing.Argon2, 4.0.824"
#:package Soenneker.Hashing.Argon2@4.0.824
#addin nuget:?package=Soenneker.Hashing.Argon2&version=4.0.824
#tool nuget:?package=Soenneker.Hashing.Argon2&version=4.0.824
Soenneker.Hashing.Argon2
Hashes passwords with Argon2id and stores the salt, work factors, and derived hash in one PHC-style string. Verification reads the parameters from that string and compares derived bytes in constant time.
Installation
dotnet add package Soenneker.Hashing.Argon2
Hash and verify a password
using Soenneker.Hashing.Argon2;
string storedHash = await Argon2HashingUtil.Hash(password);
bool valid = await Argon2HashingUtil.Verify(candidatePassword, storedHash);
Store storedHash exactly as returned. It has this shape:
$argon2id$v=19$m=131072,t=3,p=2$<salt>$<hash>
Each call to Hash() generates a new cryptographically secure 16-byte salt, so the same password produces different records. The defaults derive 32 bytes using three iterations, 128 MiB of memory, and parallelism of two.
Choose work factors deliberately
string storedHash = await Argon2HashingUtil.Hash(
password,
saltBytes: 16,
hashBytes: 32,
time: 4,
memoryKiB: 262_144,
parallelism: 4);
Tune work factors on production-class hardware and measure authentication latency under expected concurrency. Increasing memory applies per concurrent hash operation, not per process.
To prevent stored or attacker-controlled records from requesting unbounded work, hashing and verification accept salt sizes from 8–64 bytes, derived hashes from 16–128 bytes, 1–10 iterations, 8–262,144 KiB of memory, and parallelism from 1–16. Hash() throws InvalidOperationException outside those limits; Verify() returns false for malformed or excessive records.
Verify() also returns false for empty inputs, invalid Base64, unsupported versions, and mismatched passwords. Password and derived-key byte buffers are cleared after use. Applications should still rate-limit authentication attempts and avoid logging plaintext passwords or hash records.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Konscious.Security.Cryptography.Argon2 (>= 1.3.1)
- Soenneker.Extensions.Arrays.Bytes (>= 4.0.66)
- Soenneker.Extensions.String (>= 4.0.739)
- Soenneker.Extensions.Task (>= 4.0.128)
- Soenneker.Utils.Random.Security (>= 4.0.307)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.824 | 0 | 9/5/2026 |
| 4.0.823 | 31 | 9/4/2026 |
| 4.0.822 | 28 | 9/4/2026 |
| 4.0.821 | 79 | 8/31/2026 |
| 4.0.820 | 83 | 8/31/2026 |
| 4.0.819 | 76 | 8/31/2026 |
| 4.0.818 | 83 | 8/31/2026 |
| 4.0.817 | 74 | 8/30/2026 |
| 4.0.815 | 76 | 8/30/2026 |
| 4.0.814 | 79 | 8/30/2026 |
| 4.0.813 | 80 | 8/30/2026 |
| 4.0.812 | 80 | 8/30/2026 |
| 4.0.811 | 81 | 8/30/2026 |
| 4.0.810 | 82 | 8/30/2026 |
| 4.0.809 | 79 | 8/29/2026 |
| 4.0.808 | 86 | 8/29/2026 |
| 4.0.807 | 84 | 8/29/2026 |
| 4.0.806 | 81 | 8/29/2026 |
| 4.0.805 | 88 | 8/27/2026 |
| 4.0.803 | 98 | 8/21/2026 |
Update dependency Soenneker.Extensions.String to 4.0.739 (#1381)