A fully RFC-compliant cryptographic library for .NET featuring high-performance, secure implementations of modern cryptographic algorithms with multi-framework support.
✨ Features
🔐 Argon2 Password Hashing - Full RFC 9106 compliance
Argon2d, Argon2i, and Argon2id variants
Configurable memory, iterations, and parallelism
Secure salt generation and constant-time comparison
#️⃣ Blake2b Hashing - Full RFC 7693 compliance
Variable output sizes (1-64 bytes)
Keyed hashing (MAC) support
Blake2b-Long for outputs > 64 bytes
🔑 RSA Encryption - PKCS#1 v2.2 support
Key generation (512-4096 bits)
PKCS#1 v1.5 and OAEP padding
Digital signatures
📧 PGP Encryption - OpenPGP-compatible
Hybrid encryption with AES session keys
RSA key pair support
Passphrase protection for private keys
🔒 Modern Symmetric Encryption (AEAD)
ChaCha20-Poly1305 (RFC 8439) with SIMD optimizations
XChaCha20-Poly1305 (extended 24-byte nonce)
AES-GCM with hardware acceleration
AES-CCM (RFC 3610)
AES-SIV (RFC 5297) - nonce-misuse resistant
AES-OCB (RFC 7253) - high-performance AEAD
🌊 Stream Ciphers
ChaCha8/ChaCha12/ChaCha20 variants
XSalsa20
Rabbit cipher (RFC 4503) - Fully RFC-compliant with correct endianness
HC-128 and HC-256 (eSTREAM portfolio)
📐 Elliptic Curve Cryptography
Curve25519 (X25519 key exchange)
Ed25519 (digital signatures)
Secp256k1 (Bitcoin-compatible)
Hardware-accelerated field arithmetic
🔑 Key Derivation & Management
PBKDF2 (with SHA256/SHA384/SHA512)
HKDF (RFC 5869)
Scrypt (memory-hard KDF)
Balloon Hashing (cache-timing resistant)
BIP32 Hierarchical Deterministic Wallets - Production-ready with secp256k1 support
⚠️ Requires Windows CNG with PQC support or OpenSSL 3.5+
.NET Standard 2.0 Compatibility
When targeting .NET Standard 2.0, HeroCrypt automatically uses polyfills and fallback implementations:
Uses RandomNumberGenerator.Create().GetBytes() instead of RandomNumberGenerator.Fill()
AES-GCM/CCM operations throw NotSupportedException with clear upgrade guidance
Post-quantum cryptography is not available (compile-time excluded)
All other features work identically across all frameworks
📦 Installation
dotnet add package HeroCrypt
🚀 Quick Start
Argon2 Password Hashing
using HeroCrypt;
using System.Security.Cryptography;
using System.Text;
var salt = RandomNumberGenerator.GetBytes(16);
// Hash a password (Argon2id via builder)
var hashBytes = HeroCryptBuilder.DeriveKey()
.UseArgon2()
.WithPassword(Encoding.UTF8.GetBytes("mySecurePassword"))
.WithSalt(salt)
.WithIterations(3)
.WithParallelism(4)
.WithKeyLength(32)
.Build();
var hash = Convert.ToBase64String(hashBytes);
// Verify a password
var verifyBytes = HeroCryptBuilder.DeriveKey()
.UseArgon2()
.WithPassword(Encoding.UTF8.GetBytes("mySecurePassword"))
.WithSalt(salt)
.WithIterations(3)
.WithParallelism(4)
.WithKeyLength(32)
.Build();
bool isValid = HeroCrypt.Security.SecureMemoryOperations.ConstantTimeEquals(
hashBytes,
verifyBytes);