nebulae.dotBlake2b
0.3.1
dotnet add package nebulae.dotBlake2b --version 0.3.1
NuGet\Install-Package nebulae.dotBlake2b -Version 0.3.1
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.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nebulae.dotBlake2b" Version="0.3.1" />
<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.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: nebulae.dotBlake2b, 0.3.1"
#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.dotBlake2b@0.3.1
#: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.dotBlake2b&version=0.3.1
#tool nuget:?package=nebulae.dotBlake2b&version=0.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
dotBlake2b
A .NET 8+ SSE4-accelerated (x86_64) wrapper for the reference 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 SSE4/neon instructions for high-speed hashing on x86_64 & aarch64 architectures.
- 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 .NET 8+ Windows & Linux x64 and MacOS (x64 & Apple Silicon).
Requirements
- .NET 8 or later
- SSE4 or neon-capable CPU
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.