nebulae.dotPoly1305
0.1.5
dotnet add package nebulae.dotPoly1305 --version 0.1.5
NuGet\Install-Package nebulae.dotPoly1305 -Version 0.1.5
<PackageReference Include="nebulae.dotPoly1305" Version="0.1.5" />
<PackageVersion Include="nebulae.dotPoly1305" Version="0.1.5" />
<PackageReference Include="nebulae.dotPoly1305" />
paket add nebulae.dotPoly1305 --version 0.1.5
#r "nuget: nebulae.dotPoly1305, 0.1.5"
#:package nebulae.dotPoly1305@0.1.5
#addin nuget:?package=nebulae.dotPoly1305&version=0.1.5
#tool nuget:?package=nebulae.dotPoly1305&version=0.1.5
dotPoly1305
A minimal, fast, cross-platform Poly1305 wrapper for .NET applications.
This library provides access to the Poly1305 message authentication code (MAC) algorithm, which is often used in conjunction with the ChaCha20 cipher for authenticated encryption. It is designed to be lightweight and efficient, making it suitable for high-performance applications that require secure message authentication.
The underlying optimized code is from BoringSSL maintained by Google, ensuring that it is both efficient and secure.
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
- Windows x64, Linux x64, or macOS (x64 & Apple Silicon)
Usage
Poly1305 is a message authentication code (MAC) that can be used to verify the integrity and authenticity of a message. It is often used in conjunction with the ChaCha20 cipher for authenticated encryption.
Using the byte[] API:
using nebulae.dotPoly1305;
Poly1305.Init(); // Initialize the Poly1305 context
byte[] key = new byte[32]; // One-time 32-byte key
byte[] message = Encoding.ASCII.GetBytes("hello world");
byte[] tag = new byte[16]; // 16-byte output tag
Poly1305.Auth(message, key, tag);
// 'tag' now contains the authentication tag
Console.WriteLine(Convert.ToHexString(tag));
Using the ReadOnlySpan<byte> API:
using nebulae.dotPoly1305;
Poly1305.Init(); // Initialize the Poly1305 context
Span<byte> key = stackalloc byte[32]; // 32-byte one-time key
Span<byte> tag = stackalloc byte[16]; // 16-byte tag
ReadOnlySpan<byte> message = "authenticated stream data"u8;
Poly1305.Auth(message, key, tag);
// Output the tag
Console.WriteLine(Convert.ToHexString(tag));
Installation
You can install the package via NuGet:
$ dotnet add package nebulae.dotPoly1305
Or via git:
$ git clone https://github.com/nebulaeonline/dotPoly1305.git
$ cd dotPoly1305
$ 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.