LibChaCha20 1.1.0

dotnet add package LibChaCha20 --version 1.1.0                
NuGet\Install-Package LibChaCha20 -Version 1.1.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="LibChaCha20" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LibChaCha20 --version 1.1.0                
#r "nuget: LibChaCha20, 1.1.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.
// Install LibChaCha20 as a Cake Addin
#addin nuget:?package=LibChaCha20&version=1.1.0

// Install LibChaCha20 as a Cake Tool
#tool nuget:?package=LibChaCha20&version=1.1.0                

CSharp-ChaCha20-NetStandard

Managed .Net (.NET 8) compatible ChaCha20 cipher written in C#

Documentation

Docs

How do I use this?

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

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on LibChaCha20:

Package Downloads
NNostr.Client

A client for Nostr

LibCommonSecrets

.Net Standard 2.0 compatible managed CommonSecrets library implementation in C#

NostraLib

Nostr library for F#

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on LibChaCha20:

Repository Stars
Kukks/NNostr
A Nostr Relay and Client written in C#
Version Downloads Last updated
1.1.0 107 12/6/2024
1.0.1 903 11/16/2023
1.0.0 38,805 5/21/2022
0.9.5 1,252 1/9/2021
0.9.4 504 5/16/2020
0.9.3 739 5/9/2020
0.9.2 872 1/12/2020
0.9.1 1,347 11/18/2018
0.9.0 683 11/14/2018