![]() |
VOOZH | about |
dotnet add package LibChaCha20 --version 1.1.1
NuGet\Install-Package LibChaCha20 -Version 1.1.1
<PackageReference Include="LibChaCha20" Version="1.1.1" />
<PackageVersion Include="LibChaCha20" Version="1.1.1" />Directory.Packages.props
<PackageReference Include="LibChaCha20" />Project file
paket add LibChaCha20 --version 1.1.1
#r "nuget: LibChaCha20, 1.1.1"
#:package LibChaCha20@1.1.1
#addin nuget:?package=LibChaCha20&version=1.1.1Install as a Cake Addin
#tool nuget:?package=LibChaCha20&version=1.1.1Install as a Cake Tool
Managed .Net (.NET 8 and .NET 10) compatible ChaCha20 cipher written in C#
using CSChaCha20;
byte[] mySimpleTextAsBytes = Encoding.ASCII.GetBytes("Plain text I want to encrypt");
// Do NOT use these key and nonce values in your own code!
byte[] key = new byte[32] { 142, 26, 14, 68, 43, 188, 234, 12, 73, 246, 252, 111, 8, 227, 57, 22, 168, 140, 41, 18, 91, 76, 181, 239, 95, 182, 248, 44, 165, 98, 34, 12 };
byte[] nonce = new byte[12] { 139, 164, 65, 213, 125, 108, 159, 118, 252, 180, 33, 88 };
uint counter = 1;
// Encrypt
ChaCha20 forEncrypting = new ChaCha20(key, nonce, counter);
byte[] encryptedContent = new byte[mySimpleTextAsBytes.Length];
forEncrypting.EncryptBytes(encryptedContent, mySimpleTextAsBytes);
// Decrypt
ChaCha20 forDecrypting = new ChaCha20(key, nonce, counter);
byte[] decryptedContent = new byte[encryptedContent.Length];
forDecrypting.DecryptBytes(decryptedContent, encryptedContent);
You can try out the code in .NET Fiddle
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 3 NuGet packages that depend on LibChaCha20:
| Package | Downloads |
|---|---|
|
NNostr.Client
A client for Nostr |
|
|
LibCommonSecrets
.Net 10 compatible managed CommonSecrets library implementation in C# |
|
|
NostraLib
Nostr library for F# |
Showing the top 1 popular GitHub repositories that depend on LibChaCha20:
| Repository | Stars |
|---|---|
|
Kukks/NNostr
A Nostr Relay and Client written in C#
|