LinkerDesign.Crypto 0.2.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package LinkerDesign.Crypto --version 0.2.4
NuGet\Install-Package LinkerDesign.Crypto -Version 0.2.4
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="LinkerDesign.Crypto" Version="0.2.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LinkerDesign.Crypto --version 0.2.4
#r "nuget: LinkerDesign.Crypto, 0.2.4"
#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.
// Install LinkerDesign.Crypto as a Cake Addin
#addin nuget:?package=LinkerDesign.Crypto&version=0.2.4

// Install LinkerDesign.Crypto as a Cake Tool
#tool nuget:?package=LinkerDesign.Crypto&version=0.2.4


a lightweight crypto library for dotnet, which can run on linux-x64 and windows-x64 platform.


  1. Symmetric Encryt Decrypt
  1. Message Digest
  • Sha1
  • Sha256
  • Sha384
  • Sha512
  • Md5
  • Md5Sha1

more features will come soon!


dotnet add reference LinkerDesign.Crypto


  1. AES-CBC

We can use AES-CBC to encryt a string who's encoding is utf8 to a base64 string.

Additional, we can AES-CBS to decrypt a base64 string to it's original utf8 string

using LinkerDesign.Crypto;

var msg = "《青溪》是唐代诗人王维创作的一首五言古诗。此诗描写了一条青溪的幽秀景色,诗人用多彩的画笔,绘出青溪流经不同地方时呈现的不同画面。其中“声喧乱石中,色静深松里”两句,以喧响的声音和幽冷的色调形成闹与静的强烈对比,如同一幅“有声画”。诗的末四句写出诗人心境的闲谈正如清川的闲淡,把自己的精神和自然的精神融和起来,意味隽永。全诗自然清淡素雅,写景抒情皆轻轻松松,然而韵味却隽永醇厚。诗人笔下的青溪是喧闹与沉郁的统一,活泼与安详的揉合,幽深与素静的融和。";

var aes = new Aes();

string key = aes.GenerateKey(ExportType.Base64);
string iv = aes.GenerateIV(ExportType.Base64);

var enc = aes.EncryptCBCWithUTF8(key, iv, msg, exportType: ExportType.Base64);
var dec = aes.DecryptCBCWithUTF8(key, iv, enc);
Console.WriteLine($"{dec}:::equals:{msg == dec}");
  1. Message Digest

support regular message digest algorith, like sha1, sha256, md5 etc...

using LinkerDesign.Crypto;

const msg = '《青溪》是唐代诗人王维创作的一首五言古诗。此诗描写了一条青溪的幽秀景色,诗人用多彩的画笔,绘出青溪流经不同地方时呈现的不同画面。其中“声喧乱石中,色静深松里”两句,以喧响的声音和幽冷的色调形成闹与静的强烈对比,如同一幅“有声画”。诗的末四句写出诗人心境的闲谈正如清川的闲淡,把自己的精神和自然的精神融和起来,意味隽永。全诗自然清淡素雅,写景抒情皆轻轻松松,然而韵味却隽永醇厚。诗人笔下的青溪是喧闹与沉郁的统一,活泼与安详的揉合,幽深与素静的融和。';

var sha1 = new Sha1();
var hash = sha1.Digest(msg, ExportType.UTF8, ExportType.Base64);

var sha256 = new Sha256();
hash = sha256.Digest(msg, ExportType.UTF8, ExportType.Hex);

var sha384 = new Sha384();
hash = sha384.Digest(msg, ExportType.UTF8, ExportType.Hex);

var sha512 = new Sha512();
hash = sha512.Digest(msg, ExportType.UTF8, ExportType.Hex);

var md5 = new Md5();
var hashWeb = "51dac0da1863951d696e027892bdc177";
hash = md5.Digest(msg, ExportType.UTF8, ExportType.Hex);
Console.WriteLine($"{hash}:::{hash.Length}:::equals: {hash == hashWeb}");

var md5Sha1 = new Md5Sha1();
hash = md5Sha1.Digest(msg, ExportType.UTF8, ExportType.Hex);

Console.WriteLine("Hello, World!");
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 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.
  • .NETStandard 2.1

    • 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
0.3.2 191 7/13/2023
0.3.1 150 7/12/2023
0.2.4 147 6/15/2023
0.2.3 141 6/15/2023
0.2.0 136 6/13/2023
0.0.1 145 6/7/2023