ChaCha20.NetCore 1.0.0

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

// Install ChaCha20.NetCore as a Cake Tool
#tool nuget:?package=ChaCha20.NetCore&version=1.0.0                

ChaCha20.NetCore

License: MIT nuget

Implementation of chacha20 cipher, designed by D. J. Bernstein. Optimized for PinnedMemory.

Install

From a command prompt

dotnet add package ChaCha20.NetCore
Install-Package ChaCha20.NetCore

You can also search for package via your nuget ui / website:

https://www.nuget.org/packages/ChaCha20.NetCore/

Examples

You can find more examples in the github examples project.

var iv = new byte[16];
var key = new byte[32];

using var provider = new RNGCryptoServiceProvider();
provider.GetBytes(iv);
provider.GetBytes(key);

using var keyPin = new PinnedMemory<byte>(key, false);
using var cipher = new ChaCha20(keyPin, iv);
cipher.UpdateBlock(new PinnedMemory<byte>(new byte[] {63, 61, 77, 20, 63, 61, 77, 20, 63, 61, 77}, false), 0, 11); // caw caw caw in utf8

using var output = new PinnedMemory<byte>(new byte[cipher.GetLength()]);
cipher.DoFinal(output, 0);

Constructor

ChaCha20(PinnedMemory<byte> key, byte[] iv, int rounds = 20)

Methods

Get the cipher output length.

int GetLength()

Update the cipher with a single byte.

void Update(byte input)

Update the cipher with a pinned memory byte array.

void UpdateBlock(PinnedMemory<byte> input, int inOff, int len)

Update the cipher with a byte array.

void UpdateBlock(byte[] input, int inOff, int len)

Produce the final cipher outputting to pinned memory. Key & iv remain until dispose is called.

void DoFinal(PinnedMemory<byte> output, int outOff)

Reset the cipher back to it's initial state for further processing. Key & iv remain until dispose is called.

void Reset()

Clear key & iv, reset cipher back to it's initial state.

void Dispose()
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.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ChaCha20.NetCore:

Package Downloads
AeadChaCha20Poly1305.NetCore

Implementation of AEAD_CHACHA20_POLY1305 an authenticated encryption with additional data algorithm using ChaCha20, and Poly1305 designed by D. J. Bernstein. Optimized for PinnedMemory, and .NET core.

Poly1305ChaCha20.NetCore

Implementation of poly1305-dona message authentication code, designed by D. J. Bernstein with a chacha20 nonce. Optimized for PinnedMemory depends on ChaCha20.NetCore.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 854 8/11/2020
1.0.2 478 8/11/2020
1.0.1 478 8/11/2020
1.0.0 645 7/26/2020