nebulae.dotAead
0.1.1
dotnet add package nebulae.dotAead --version 0.1.1
NuGet\Install-Package nebulae.dotAead -Version 0.1.1
<PackageReference Include="nebulae.dotAead" Version="0.1.1" />
<PackageVersion Include="nebulae.dotAead" Version="0.1.1" />
<PackageReference Include="nebulae.dotAead" />
paket add nebulae.dotAead --version 0.1.1
#r "nuget: nebulae.dotAead, 0.1.1"
#:package nebulae.dotAead@0.1.1
#addin nuget:?package=nebulae.dotAead&version=0.1.1
#tool nuget:?package=nebulae.dotAead&version=0.1.1
dotAead
High-performance, cross-platform AEAD encryption library implementing ChaCha20-Poly1305 (RFC 8439).
Built using BoringSSL's optimized ChaCha20 (AVX2, NEON) and Poly1305 primitives with platform-specific acceleration.
Provides fast, deterministic authenticated encryption suitable for secure messaging, tokens, and key material.
Ships as a native library (Windows, Linux, macOS) with direct bindings for low-level interop.
Tests are included and available in the Github repo.
Features
- Cross-platform: Works on Windows, Linux, and macOS (x64 & Apple Silicon).
- High performance: Optimized for speed, leveraging native SIMD-enabled code.
- Easy to use: Simple API for encryption and decryption.
- Secure: Uses BoringSSL's implementation, which is widely trusted in the industry.
- Minimal dependencies: No external dependencies required (all are included), making it lightweight and easy to integrate.
Requirements
- .NET 8.0 or later
- AVX2 compatible CPU or Apple Silicon
- Windows x64, Linux x64, or macOS (x64 & Apple Silicon)
Usage
Using the byte API:
using nebulae.dotAead;
public class ByteArrayExample
{
public static void Run()
{
byte[] key = new byte[32]; // all-zero key
byte[] nonce = new byte[12]; // all-zero nonce
byte[] aad = System.Text.Encoding.UTF8.GetBytes("example-aad");
byte[] plaintext = System.Text.Encoding.UTF8.GetBytes("secret message");
byte[] ciphertext = new byte[plaintext.Length];
byte[] tag = new byte[16];
byte[] decrypted = new byte[plaintext.Length];
int result = Aead.Encrypt(key, nonce, plaintext, aad, ciphertext, tag);
if (result != 0)
throw new Exception("Encryption failed");
result = Aead.Decrypt(key, nonce, ciphertext, aad, tag, decrypted);
if (result != 0)
throw new Exception("Decryption failed");
string roundtrip = System.Text.Encoding.UTF8.GetString(decrypted);
Console.WriteLine($"Roundtrip success: {roundtrip}");
}
}
Using the Span API:
using nebulae.dotAead;
public class SpanExample
{
public static void Run()
{
Span<byte> key = stackalloc byte[32];
Span<byte> nonce = stackalloc byte[12];
ReadOnlySpan<byte> aad = "example-aad"u8;
ReadOnlySpan<byte> plaintext = "secret message"u8;
Span<byte> ciphertext = new byte[plaintext.Length];
Span<byte> tag = new byte[16];
Span<byte> decrypted = new byte[plaintext.Length];
int result = Aead.Encrypt(key, nonce, plaintext, aad, ciphertext, tag);
if (result != 0)
throw new Exception("Encryption failed");
result = Aead.Decrypt(key, nonce, ciphertext, aad, tag, decrypted);
if (result != 0)
throw new Exception("Decryption failed");
string roundtrip = System.Text.Encoding.UTF8.GetString(decrypted);
Console.WriteLine($"Roundtrip success: {roundtrip}");
}
}
Installation
You can install the package via NuGet:
$ dotnet add package nebulae.dotAead
Or via git:
$ git clone https://github.com/nebulaeonline/dotAead.git
$ cd dotAead
$ dotnet build
License
MIT
Roadmap
Unless there are vulnerabilities found, there are no plans to add any new features.
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. |
-
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.