Snail.Toolkit.Cryptography 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Snail.Toolkit.Cryptography --version 1.0.0
                    
NuGet\Install-Package Snail.Toolkit.Cryptography -Version 1.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="Snail.Toolkit.Cryptography" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Snail.Toolkit.Cryptography" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Snail.Toolkit.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 Snail.Toolkit.Cryptography --version 1.0.0
                    
#r "nuget: Snail.Toolkit.Cryptography, 1.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.
#addin nuget:?package=Snail.Toolkit.Cryptography&version=1.0.0
                    
Install Snail.Toolkit.Cryptography as a Cake Addin
#tool nuget:?package=Snail.Toolkit.Cryptography&version=1.0.0
                    
Install Snail.Toolkit.Cryptography as a Cake Tool

Toolkit.Cryptography

Extension for the framework System.Security.Cryptography

Sources
Connecting the configuration
builder.Services.AddCryptography(o =>
{
    o.Passphrase = "123456";
    o.IV = "abcede0123456789";
});

or

builder.Services.AddCryptography(builder.Configuration);

or

builder.Services.AddCryptography();

Encrypt data

var encryptToBase64 = await _cryptography.EncryptToBase64Async(string);

Decrypt data

var decryptFromBase64 = await _cryptography.DecryptFromBase64Async(string);
Sample configuration appsettings.json
{
  "Cryptography": {
    "Passphrase" : "0123456789",
    "IV" : "abcede0123456789",
    "Salt" : "0123456789abcede",
    "Iterations" : 1000,
    "DesiredKeyLength" : 16, // 16 bytes equal 128 bits. Max 256 bits
    "HashMethod" : "SHA384"
  }
}

The name of the algorithm supported by cryptographic hashing HashMethod.

  • SHA1
  • SHA256
  • SHA384
  • SHA512

This is an unsupported hashing algorithm.

  • MD5
  • SHA3-256
  • SHA3-384
  • SHA3-512

License

Toolkit.Cryptography is a free and open source project, released under the permissible MIT license.

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 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 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Snail.Toolkit.Cryptography:

Package Downloads
Snail.Toolkit.Blazor.Extensions.Cryptography

Extension for the framework Blazor

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 124 5/31/2025
1.0.1 87 5/31/2025
1.0.0 218 5/15/2025