DrUalcman-Cipher 1.3.10

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

DrUalcman-Cipher

A .NET library for encryption, decryption, and token generation with support for Base64, MD5 hashing, and JWT tokens.

Features

Secret Class

  • Encrypt and decrypt text using a custom algorithm with secret keys
  • Supports both synchronous and asynchronous operations
  • Generate and verify hash keys using MD5
  • Multiple constructors for different initialization scenarios

JWT Class

  • Create and verify JSON Web Tokens (JWT)
  • Support for custom claims, issuer, audience, and roles
  • Token expiration configuration
  • Both standard HS256 and custom DRCKJ algorithms
  • Synchronous and asynchronous methodsHash Utilities

MD5 hash computation

  • Base64 encoding/decoding (standard and URL-safe variants)
  • Hexagesimal conversions

Instalation

Install nuget

dotnet add package DrUalcman-Cipher

Usage

Secret Class Examples

// Initialize with default secret and key
var secret = new Secret();

// Initialize with custom secret and key
var secret = new Secret("mysecret", 123);

// Encrypt text
string encrypted = secret.Encrypt("Hello World");

// Decrypt text
string decrypted = secret.Decrypt(encrypted);

// Generate hash key
string hash = secret.GetHashKey();

// Verify hash key
bool isValid = secret.VerifyHashKey(hash);

JWT Class Examples

// Create a basic token with default expiration (7 days)
string token = JWT.CreateToken();

// Create token with custom claims
var claims = new Dictionary<string, object>
{
    { "userId", 123 },
    { "username", "john.doe" }
};
string token = JWT.CreateToken(claims);
// Verify token signature
bool isValid = JWT.VerifySignature(token);

// Create token with custom key
string token = JWT.CreateToken(claims, "mysecretkey");

// Verify token signature
bool isValid = JWT.VerifySignature(token, "mysecretkey");

// Get payload from token
if (JWT.TryGetPayloadToken(token, out var payload))
{
    // Use payload data
}

Hash Utilities Examples

// MD5 Hash
MD5 md5 = new MD5();
string hash = md5.ComputeHash("text to hash");

// Base64 Encoding
string encoded = Base64.Base64Encode("text to encode");
string decoded = Base64.Base64Decode(encoded);

// URL-safe Base64
string urlEncoded = Base64.Base64UrlEncode("text to encode");
string urlDecoded = Base64.Base64UrlDecode(urlEncoded);

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please submit pull requests or open issues to discuss changes.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.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.

Version Downloads Last Updated
1.3.10 151 6/1/2025
1.2.9 710 6/16/2021
1.2.8 481 5/30/2021
1.1.7 445 4/10/2021
1.1.6 421 3/31/2021
1.1.5 484 3/28/2021
1.0.4 470 3/27/2021
1.0.3 398 3/26/2021
1.0.2 413 3/25/2021

Update license. Add NET 9 support.