Pandatech.Crypto 8.0.0

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

Pandatech.Crypto

Unified cryptographic wrapper library for .NET 8+ providing AES encryption, password hashing, compression, and secure random generation.

Installation

dotnet add package Pandatech.Crypto

Quick Start

Configuration (ASP.NET Core)

builder.AddAes256Key("your-base64-encoded-256-bit-key");

// Optional: configure Argon2id (defaults shown)
builder.ConfigureArgon2Id(options =>
{
   options.SaltSize = 16;
   options.DegreeOfParallelism = 8;
   options.Iterations = 5;
   options.MemorySize = 128 * 1024; // 128 MB
});

Core Features

AES-256-GCM (Files & Streams)

Authenticated encryption with associated data. Best for files.

// Encrypt
Aes256Gcm.RegisterKey(key);
using var input = File.OpenRead("document.pdf");
using var output = File.Create("document.pdf.enc");
Aes256Gcm.Encrypt(input, output);

// Decrypt
using var encrypted = File.OpenRead("document.pdf.enc");
using var decrypted = File.Create("document.pdf");
Aes256Gcm.Decrypt(encrypted, decrypted);

AES-256-SIV (Deterministic Encryption)

RFC 5297 compliant. Use for PII that needs deterministic matching.

Aes256Siv.RegisterKey(key);

byte[] cipher = Aes256Siv.Encrypt("sensitive-data");
string plain = Aes256Siv.Decrypt(cipher);

Argon2id Password Hashing

byte[] hash = Argon2Id.HashPassword("user-password");
bool valid = Argon2Id.VerifyHash("user-password", hash);

JWE (RSA-OAEP-256 + AES-256-GCM)

Envelope encryption with JWK keys and RFC 7638 thumbprints.

var (publicJwk, privateJwk, kid) = JoseJwe.IssueKeys(bits: 2048);

var jwe = JoseJwe.Encrypt(publicJwk, payload, kid);

if (JoseJwe.TryDecrypt(privateJwk, jwe, out var decrypted))
{
   // use decrypted bytes
}

Secure Random

byte[] randomBytes = Random.GenerateBytes(32);
string aesKey = Random.GenerateAes256KeyString();
string token = Random.GenerateSecureToken(); // 256-bit URL-safe

Password Generation & Validation

string pwd = Password.GenerateRandom(
   length: 16,
   includeUppercase: true,
   includeLowercase: true,
   includeDigits: true,
   includeSpecialChars: true
);

bool valid = Password.Validate(pwd, minLength: 16, 
   requireUppercase: true, requireLowercase: true, 
   requireDigits: true, requireSpecialChars: true);

Hashing

// SHA-2 HMAC
byte[] hmac = Sha2.ComputeHmacSha256(key, "message1", "message2");
string hex = Sha2.GetHmacSha256Hex(key, "message");

// SHA-3
byte[] hash = Sha3.Hash("data");
bool valid = Sha3.VerifyHash("data", hash);

GZip Compression

// String
byte[] compressed = GZip.Compress("data");
string decompressed = Encoding.UTF8.GetString(GZip.Decompress(compressed));

// Streams
GZip.Compress(inputStream, outputStream);
GZip.Decompress(inputStream, outputStream);

Data Masking

string masked = "user@example.com".MaskEmail();     // "us****@example.com"
string masked = "1234567890".MaskPhoneNumber();     // "******7890"

License

MIT

Product 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Pandatech.Crypto:

Package Downloads
Pandatech.SharedKernel

Opinionated ASP.NET Core 10 infrastructure kernel: OpenAPI (Swagger + Scalar), Serilog, MediatR, FluentValidation, CORS, SignalR, OpenTelemetry, health checks, maintenance mode, resilience pipelines, and shared utilities.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.0.0 138 2/28/2026
7.1.0 143 1/26/2026
7.0.0 142 12/28/2025
6.1.1 287 9/22/2025
6.1.0 360 9/17/2025
6.0.0 260 9/2/2025
5.0.3 320 8/7/2025
5.0.2 314 6/1/2025
5.0.1 258 5/1/2025
5.0.0 229 4/11/2025
4.1.2 392 2/17/2025
4.1.1 430 11/28/2024
4.1.0 219 11/26/2024
4.0.0 269 11/21/2024
3.0.0 220 10/28/2024
2.6.1 250 10/19/2024
2.6.0 216 10/19/2024
2.5.1 236 10/18/2024
2.5.0 258 6/21/2024
2.4.1 247 6/14/2024
Loading failed

Major modernization: multi-target net8.0/9.0/10.0, framework-first dependencies, optimized allocations, updated package metadata