Soenneker.Hashing.Argon2 4.0.817

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Hashing.Argon2 --version 4.0.817
                    
NuGet\Install-Package Soenneker.Hashing.Argon2 -Version 4.0.817
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Hashing.Argon2" Version="4.0.817" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Hashing.Argon2" Version="4.0.817" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Hashing.Argon2" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Hashing.Argon2 --version 4.0.817
                    
#r "nuget: Soenneker.Hashing.Argon2, 4.0.817"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Hashing.Argon2@4.0.817
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Hashing.Argon2&version=4.0.817
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Hashing.Argon2&version=4.0.817
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.846 86 9/16/2026
4.0.845 70 9/16/2026
4.0.844 74 9/16/2026
4.0.843 76 9/15/2026
4.0.842 72 9/15/2026
4.0.841 78 9/15/2026
4.0.840 82 9/13/2026
4.0.839 89 9/13/2026
4.0.837 90 9/12/2026
4.0.836 88 9/12/2026
4.0.835 83 9/12/2026
4.0.834 84 9/12/2026
4.0.832 102 9/9/2026
4.0.831 96 9/8/2026
4.0.830 89 9/8/2026
4.0.829 99 9/7/2026
4.0.828 91 9/7/2026
4.0.827 101 9/7/2026
4.0.826 98 9/7/2026
4.0.817 91 8/30/2026
Loading failed

Update dependency Soenneker.Utils.Random.Security to 4.0.306 (#1364)