LibChaCha20 1.1.2

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

CSharp-ChaCha20-NetStandard

Managed .Net (.NET 8 and .NET 10) 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.  net10.0 is compatible.  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.
  • net10.0

    • No dependencies.
  • 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 10 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.2 106 6/30/2026
1.1.1 969 11/13/2025
1.1.0 626 12/6/2024
1.0.1 6,714 11/16/2023
1.0.0 55,129 5/21/2022
0.9.5 1,488 1/9/2021
0.9.4 739 5/16/2020
0.9.3 1,041 5/9/2020
0.9.2 1,151 1/12/2020
0.9.1 2,437 11/18/2018
0.9.0 931 11/14/2018

## Version 1.1.2 (released 2026-06-30)
- Enable `Nullable` (**FEATURE**/**BREAKING**)

## Version 1.1.1 (released 2025-11-13)
- Support net10.0

## Version 1.1.0 (released 2024-12-06)
- Drop support for .NET Standard and .NET 6 (**BREAKING**)
- SIMD support for XOR operation (**PERFORMANCE**)

## Version 1.0.1 (released 2023-11-16)
- Include nuget-readme
- Support net8.0
- Trimmable library

## Version 1.0.0 (released 2022-05-21)
- Support net6.0
- Deterministic build

## Version 0.9.5 (released 2021-01-09)
- WorkStreams optimization, thanks to **Akintos** (**PERFORMANCE**)

## Version 0.9.4 (released 2020-05-16)
- Add wanted bytes at time parameter for stream encryption/decryption (**FEATURE**)
- Add async versions of stream processing (**FEATURE**)

## Version 0.9.3 (released 2020-05-09)
- Support stream encryption/decryption (**FEATURE**)

## Version 0.9.2 (released 2020-01-12)
- Generate documentation (**FEATURE**)

## Version 0.9.1 (released 2018-11-18)
- More overloads for encrypt/decrypt (no need to pass lengths of arrays anymore)
- One method to handle strings (as UTF-8 byte array)

## Version 0.9.0 (released 2018-11-14)
- Initial Nuget release
- Just one encrypt and decrypt method