nebulae.dotArgon2 0.7.12

dotnet add package nebulae.dotArgon2 --version 0.7.12
                    
NuGet\Install-Package nebulae.dotArgon2 -Version 0.7.12
                    
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="nebulae.dotArgon2" Version="0.7.12" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nebulae.dotArgon2" Version="0.7.12" />
                    
Directory.Packages.props
<PackageReference Include="nebulae.dotArgon2" />
                    
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 nebulae.dotArgon2 --version 0.7.12
                    
#r "nuget: nebulae.dotArgon2, 0.7.12"
                    
#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 nebulae.dotArgon2@0.7.12
                    
#: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=nebulae.dotArgon2&version=0.7.12
                    
Install as a Cake Addin
#tool nuget:?package=nebulae.dotArgon2&version=0.7.12
                    
Install as a Cake Tool

nebulae.dotArgon2

A minimal, fast, cross-platform Argon2 wrapper for .NET applications.

This library provides access to native Argon2id, Argon2i, and Argon2d password hashing using optimized AVX2-enabled builds of the official reference implementation.

NuGet


Features

  • Supports Argon2id, Argon2i, and Argon2d
  • Exposes both raw byte output and encoded string output
  • Full control over all parameters: memory cost, time cost, parallelism (nothing is hidden away, so you can follow OWASP recommendations)
  • Cross-platform support: Windows, Linux, macOS
  • Ships with native binaries: .dll, .so, .dylib
  • Built against the SIMD-optimized version of the Argon2 reference implementation
  • Requires AVX2 instruction set (x86_64 only)

Requirements

  • .NET 8 or later
  • AVX2-capable CPU (required for the optimized native library)
  • Windows x64, Linux x64, or macOS x64/arm64

Note: On macOS, the library ships as a universal dylib supporting both Intel and Apple Silicon. The arm64 build uses the reference (non-AVX2) implementation.


Usage

For general usage, it is recommended to use the encoded string output for password hashing. If you do so you can use the built-in verification functions. Otherwise, you must re-compute the hash using the same original settings and compare the raw hashes yourself.

Important: salts are required to be at least 8 bytes in length; this is a requirement of the underlying Argon2 library.


using nebulae.dotArgon2;

// Ensure native library is loaded (no longer necessary in recent versions)
// Argon2.Init();

// Set inputs
byte[] password = Encoding.UTF8.GetBytes("correct horse battery staple");
byte[] salt = Encoding.UTF8.GetBytes("sodiumchloride");

// Choose the variant
var algorithm = Argon2.Argon2Algorithm.Argon2id;

// Hash to a raw 32-byte buffer
byte[] rawHash = Argon2.Argon2HashRaw(
    algorithm,
    timeCost: 2,
    memCost: 65536,
    parallelism: 2,
    password,
    salt,
    hashLength: 32);

// Get a base64-compatible encoded string
string encoded = Argon2.Argon2HashEncodedToString(
    algorithm,
    timeCost: 2,
    memCost: 65536,
    parallelism: 2,
    password,
    salt);

// Verify the encoded hash using the original password
bool isValid = Argon2.VerifyEncoded(algorithm, encoded, password);


Installation

You can install the package via NuGet:


$ dotnet add package nebulae.dotArgon2

Or via git:


$ git clone https://github.com/nebulaeonline/dotArgon2.git
$ cd dotArgon2
$ dotnet build


License

MIT

Roadmap

  • Secure memory clearing for sensitive hash buffers
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

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
0.7.12 92 8/22/2025
0.7.11 73 8/22/2025
0.7.10 113 8/9/2025
0.7.9 219 8/6/2025
0.7.8 222 6/9/2025