nebulae.dotBlake2b
0.2.8
dotnet add package nebulae.dotBlake2b --version 0.2.8
NuGet\Install-Package nebulae.dotBlake2b -Version 0.2.8
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.dotBlake2b" Version="0.2.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nebulae.dotBlake2b" Version="0.2.8" />
<PackageReference Include="nebulae.dotBlake2b" />
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.dotBlake2b --version 0.2.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: nebulae.dotBlake2b, 0.2.8"
#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.
#addin nuget:?package=nebulae.dotBlake2b&version=0.2.8
#tool nuget:?package=nebulae.dotBlake2b&version=0.2.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
dotBlake2b
A pure .NET 8+ AVX2-accelerated (x86_64) implementation of the Blake2b hash function. This library is designed to be fast and efficient, leveraging the latest advancements in .NET for optimal performance.
Test & benchmark suite available on the GitHub repository.
Features
- Streaming API for hashing large data efficiently.
- MAC (Message Authentication Code) support for data integrity verification.
- Performance: Utilizes AVX2 instructions for high-speed hashing on x86_64 architectures.
- Compatibility: Works with .NET 8 and later versions (scalar fallback on non-x86_64 platforms).
- Simplicity: Easy to integrate into existing .NET applications with minimal setup.
- Security: Implements the Blake2b hash function, known for its security and speed.
- No External Dependencies: A self-contained library with no external dependencies, ensuring easy deployment.
- Cross-Platform: Compatible with any platform that supports .NET 8+.
Requirements
- .NET 8 or later
- AVX2-capable CPU for optimal performance
Usage
using System;
using System.Text;
using nebulae.dotBlake2b;
class Program
{
static void Main()
{
// 1. One-shot hash
string input = "The quick brown fox jumps over the lazy dog";
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
Span<byte> hash1 = stackalloc byte[64];
Blake2b.ComputeHash(inputBytes, hash1, 64);
Console.WriteLine("One-shot hash: " + Convert.ToHexString(hash1));
// 2. Streaming hash in chunks
var hasher = new Blake2bHasher(64);
hasher.Update(inputBytes.AsSpan(0, 20));
hasher.Update(inputBytes.AsSpan(20));
Span<byte> hash2 = stackalloc byte[64];
hasher.Finalize(hash2);
Console.WriteLine("Streaming hash: " + Convert.ToHexString(hash2));
// 3. MAC (keyed hash)
byte[] key = Encoding.UTF8.GetBytes("supersecretkey");
var mac = new Blake2bHasher(key, 64);
mac.Update(inputBytes);
Span<byte> hash3 = stackalloc byte[64];
mac.Finalize(hash3);
Console.WriteLine("Keyed MAC hash: " + Convert.ToHexString(hash3));
}
}
Installation
You can install the package via NuGet:
$ dotnet add package nebulae.dotBlake2b
Or via git:
$ git clone https://github.com/nebulaeonline/dotBlake2b.git
$ cd dotBlake2b
$ dotnet build
License
MIT
Roadmap
- Potential support for Blake2s in the future
Product | Versions 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.2.8 | 278 | 6/10/2025 |