CryptoHives.Foundation.Security.Cryptography
0.6.79
dotnet add package CryptoHives.Foundation.Security.Cryptography --version 0.6.79
NuGet\Install-Package CryptoHives.Foundation.Security.Cryptography -Version 0.6.79
<PackageReference Include="CryptoHives.Foundation.Security.Cryptography" Version="0.6.79" />
<PackageVersion Include="CryptoHives.Foundation.Security.Cryptography" Version="0.6.79" />
<PackageReference Include="CryptoHives.Foundation.Security.Cryptography" />
paket add CryptoHives.Foundation.Security.Cryptography --version 0.6.79
#r "nuget: CryptoHives.Foundation.Security.Cryptography, 0.6.79"
#:package CryptoHives.Foundation.Security.Cryptography@0.6.79
#addin nuget:?package=CryptoHives.Foundation.Security.Cryptography&version=0.6.79
#tool nuget:?package=CryptoHives.Foundation.Security.Cryptography&version=0.6.79
π‘οΈ CryptoHives Open Source Initiative π
An open, community-driven collection of cryptography and performance libraries for the .NET ecosystem, maintained by The Keepers of the CryptoHives.
π CryptoHives.Foundation.Security.Cryptography
Fully managed, OS-independent implementations of hash, MAC, KDF, and cipher algorithms for .NET, written directly from NIST/RFC/ISO specifications and checked against official test vectors.
No OS crypto dependency means deterministic results on every platform. Where the hardware supports it, intrinsics are used automatically β AES-NI, PCLMULQDQ/VPCLMULQDQ, SSE2, SSSE3, AVX2 and AVX-512 on x86/x64; ARM AES, ARM SHA-1/SHA-2, PMULL and NEON on Arm64.
π₯ Installation
dotnet add package CryptoHives.Foundation.Security.Cryptography
β¨ Key Features
- OS-independent β identical results on Windows, Linux, macOS, and anywhere else .NET runs
- Standards-based β implemented from NIST, RFC, and ISO specifications; validated against official test vectors
- Hardware-accelerated β automatic dispatch across AES-NI/AVX2/AVX-512 and the Arm64 crypto and NEON paths, with a scalar fallback always available
- Allocation-free hot paths β
Span<byte>-based APIs, friendly tostackalloc - XOF streaming β
IExtendableOutput(Absorb/Squeeze/Reset) on all XOF algorithms HashAlgorithmcompatible β drop-in for anything consumingSystem.Security.Cryptography.HashAlgorithm- Broad algorithm coverage β SHA-2/3, Keccak, SHAKE, BLAKE2/3, Ascon, regional ciphers, and more
𧬠Supported Algorithms
| Family | Algorithms |
|---|---|
| SHA-2 | SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256 |
| SHA-3 | SHA3-224, SHA3-256, SHA3-384, SHA3-512 |
| Keccak | Keccak-256, Keccak-384, Keccak-512 (Ethereum-compatible) |
| SHAKE / cSHAKE | SHAKE128, SHAKE256, cSHAKE128, cSHAKE256 |
| TurboSHAKE / KT | TurboSHAKE128, TurboSHAKE256, KT128, KT256 |
| ParallelHash (SP 800-185) | ParallelHash128, ParallelHash256 |
| BLAKE | BLAKE2b, BLAKE2s (SIMD-accelerated), BLAKE3 |
| Ascon | Ascon-Hash256, Ascon-XOF128 (NIST SP 800-232 lightweight) |
| Regional hash | SM3, Streebog, Kupyna, LSH, Whirlpool, RIPEMD-160 |
| Legacy | SHA-1, MD5, HMAC-SHA-1, HMAC-MD5 (backward compatibility only) |
| MAC | HMAC-SHA-256/384/512, HMAC-SHA3-256/384/512, AES-CMAC, AES-GMAC, Poly1305, KMAC128/256, BLAKE2/3 keyed |
| Cipher (AEAD) | AES-GCM (128/192/256), AES-CCM (128/192/256), ChaCha20-Poly1305, XChaCha20-Poly1305, Ascon-AEAD128 |
| Cipher (block/stream) | AES-128/192/256 (ECB/CBC/CTR), ChaCha20 |
| Cipher (regional) | SM4, ARIA, Camellia, Kuznyechik, Kalyna (128/256/512), SEED |
| KDF | HKDF, KBKDF, ConcatKDF, PBKDF2 |
π‘ Quick Examples
Allocation-Free Hash (Blake3)
using CryptoHives.Foundation.Security.Cryptography.Hash;
using var blake3 = Blake3.Create();
Span<byte> hash = stackalloc byte[32];
blake3.TryComputeHash(data, hash, out _);
XOF Streaming (Shake256)
using CryptoHives.Foundation.Security.Cryptography.Hash;
// Variable-length output via IExtendableOutput
using var shake = Shake256.Create(outputBytes: 64);
shake.Absorb(context);
shake.Absorb(message);
Span<byte> output = stackalloc byte[64];
shake.Squeeze(output);
shake.Reset(); // Reuse the instance
Keyed Hash / MAC (HMAC-SHA-256)
using CryptoHives.Foundation.Security.Cryptography.Mac;
using var hmac = new HmacSha256(key);
Span<byte> tag = stackalloc byte[32];
hmac.Update(message); // call as often as needed
hmac.Finalize(tag); // writes the 32-byte tag
hmac.Reset(); // reuse the instance for the next message
Authenticated Encryption (AES-GCM)
using CryptoHives.Foundation.Security.Cryptography.Cipher;
using System.Security.Cryptography; // for CryptographicException
using var aesGcm = new AesGcm256(key);
// Encrypt
Span<byte> ciphertext = new byte[plaintext.Length];
Span<byte> tag = stackalloc byte[16];
aesGcm.Encrypt(nonce, plaintext, ciphertext, tag, associatedData);
// Decrypt β returns false (and clears `recovered`) if tag verification fails;
// it does not throw. Always check the result before trusting the output.
Span<byte> recovered = new byte[ciphertext.Length];
if (!aesGcm.Decrypt(nonce, ciphertext, tag, recovered, associatedData))
{
throw new CryptographicException("Authentication failed.");
}
cSHAKE β Domain-Separated XOF
using CryptoHives.Foundation.Security.Cryptography.Hash;
using var cshake = CShake128.Create(
outputBytes: 32,
functionName: "MyApp"u8.ToArray(),
customization: "v1"u8.ToArray());
cshake.Absorb(input);
Span<byte> derived = stackalloc byte[32];
cshake.Squeeze(derived);
π Documentation
| Resource | Link |
|---|---|
| Full package documentation | cryptohives.github.io/Foundation/packages/security/cryptography |
| Hash algorithms guide | cryptohives.github.io/β¦/hash-algorithms |
| Cipher algorithms guide | cryptohives.github.io/β¦/cipher-algorithms |
| XOF mode guide | cryptohives.github.io/β¦/xof-mode |
| Benchmarks (interactive dashboard) | cryptohives.github.io/β¦/benchmarks |
| MAC algorithms guide | cryptohives.github.io/β¦/mac-algorithms |
| API reference | cryptohives.github.io/β¦/api/β¦Cryptography.Hash |
| Source repository | github.com/CryptoHives/Foundation |
π¨ Security Policy
Every algorithm is implemented from its published specification and validated against official test vectors. Public APIs are designed assuming hostile input.
If you discover a vulnerability, please don't open a public issue β follow the process on the CryptoHives Security Page instead.
βοΈ License
MIT β Β© 2026 The Keepers of the CryptoHives
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 is compatible. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Microsoft.Bcl.Memory (>= 10.0.11)
- Microsoft.Extensions.ObjectPool (>= 10.0.11)
- System.Memory (>= 4.6.3)
-
.NETFramework 4.7.2
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Microsoft.Bcl.Memory (>= 10.0.11)
- Microsoft.Extensions.ObjectPool (>= 10.0.11)
- System.Memory (>= 4.6.3)
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
- Microsoft.Bcl.Memory (>= 10.0.11)
- Microsoft.Extensions.ObjectPool (>= 10.0.11)
- System.Memory (>= 4.6.3)
-
.NETStandard 2.1
- Microsoft.Bcl.Memory (>= 10.0.11)
- Microsoft.Extensions.ObjectPool (>= 10.0.11)
-
net10.0
- Microsoft.Extensions.ObjectPool (>= 10.0.11)
-
net8.0
- Microsoft.Extensions.ObjectPool (>= 10.0.11)
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.6.79 | 73 | 8/12/2026 |
| 0.6.51 | 234 | 8/1/2026 |
| 0.6.21 | 254 | 7/4/2026 |
| 0.5.34-preview | 632 | 6/2/2026 |
| 0.5.21-preview | 171 | 5/2/2026 |
| 0.5.13-preview | 127 | 4/2/2026 |
| 0.4.21-preview | 123 | 3/1/2026 |
| 0.4.11-preview | 124 | 2/14/2026 |
| 0.3.19-preview | 127 | 1/26/2026 |