CryptoHives.Foundation.Security.Cryptography 0.6.21

dotnet add package CryptoHives.Foundation.Security.Cryptography --version 0.6.21
                    
NuGet\Install-Package CryptoHives.Foundation.Security.Cryptography -Version 0.6.21
                    
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="CryptoHives.Foundation.Security.Cryptography" Version="0.6.21" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CryptoHives.Foundation.Security.Cryptography" Version="0.6.21" />
                    
Directory.Packages.props
<PackageReference Include="CryptoHives.Foundation.Security.Cryptography" />
                    
Project file
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 CryptoHives.Foundation.Security.Cryptography --version 0.6.21
                    
#r "nuget: CryptoHives.Foundation.Security.Cryptography, 0.6.21"
                    
#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 CryptoHives.Foundation.Security.Cryptography@0.6.21
                    
#: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=CryptoHives.Foundation.Security.Cryptography&version=0.6.21
                    
Install as a Cake Addin
#tool nuget:?package=CryptoHives.Foundation.Security.Cryptography&version=0.6.21
                    
Install as a Cake Tool

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

NuGet Tests

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, AES-NI, PCLMULQDQ, VPCLMULQDQ, SSE2, SSSE3, and AVX2 intrinsics are used automatically.


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 AES-NI, AVX2, SSSE3 dispatch, with a scalar fallback always available
  • Allocation-free hot pathsSpan<byte>-based APIs, friendly to stackalloc
  • XOF streamingIExtendableOutput (Absorb / Squeeze / Reset) on all XOF algorithms
  • HashAlgorithm compatible — drop-in for anything consuming System.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(outputLength: 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.TryComputeHash(message, tag, out _);

Authenticated Encryption (AES-GCM)

using CryptoHives.Foundation.Security.Cryptography.Cipher;

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(
    functionName: "MyApp"u8,
    customization: "v1"u8,
    outputLength: 32);

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
Hash benchmarks cryptohives.github.io/…/benchmarks-hash
Cipher benchmarks cryptohives.github.io/…/benchmarks-cipher
API reference cryptohives.github.io/Foundation/api
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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.21 53 7/4/2026
0.5.34-preview 584 6/2/2026
0.5.21-preview 126 5/2/2026
0.5.13-preview 85 4/2/2026
0.4.21-preview 79 3/1/2026
0.4.11-preview 80 2/14/2026
0.3.19-preview 86 1/26/2026