GoeaLabs.Chaos 0.4.0-rc.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
.NET 6.0
This is a prerelease version of GoeaLabs.Chaos.
dotnet add package GoeaLabs.Chaos --version 0.4.0-rc.1
NuGet\Install-Package GoeaLabs.Chaos -Version 0.4.0-rc.1
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="GoeaLabs.Chaos" Version="0.4.0-rc.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GoeaLabs.Chaos --version 0.4.0-rc.1
#r "nuget: GoeaLabs.Chaos, 0.4.0-rc.1"
#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 GoeaLabs.Chaos as a Cake Addin
#addin nuget:?package=GoeaLabs.Chaos&version=0.4.0-rc.1&prerelease

// Install GoeaLabs.Chaos as a Cake Tool
#tool nuget:?package=GoeaLabs.Chaos&version=0.4.0-rc.1&prerelease


GitHub GitHub release (latest SemVer) Nuget (with prereleases)

Project Description

  • A cryptographically secure deterministic random number generator (CSDRNG) for .NET6+, based on RFC8439 ChaCha.
  • Chaos and ChaCha are algorithmically indistinguishable, but Chaos includes additional features that make it distinct enough to merit a separate name.
  • To provide clarity and facilitate comparison, a table is often the best approach:
ChaCha Chaos
Uses 1 UInt32 as block counter and 3 UInt32 as nonce. Uses 1 UInt64 as block counter and 1 UInt64 as stream counter.
Exposes one function chacha20_block(key, counter, nonce);, suitable for encryption only. Exposes 28 methods catering to encryption and general purpose usage.
Allows for 20 rounds only. Allows between 20 and 100 rounds, in increments of 10.
Does not have a standard coordinate system. Has a standard coordinate system allowing for arbitrary jumps.

Technical summary

For any given kernel (seed), Chaos is capable of producing $2^{64}$ streams, each stream containing $2^{64}$ pebbles (blocks), each pebble being composed out of 16 UInt32(s) or 64 UInt8(s).


  • Apache 2.0 license.
  • Tested against the official RFC8439 test vectors.
  • Endian-neutral.
  • Async and non-async API.
  • Produces 32, 64, 128, 256, 512, 1024, 2048, 4096 and 8192 bit cryptographically secure signed integers with custom scaling in arbitrary sub-ranges.
  • Supports the new Int128 numeric type on .NET7+.


NextBytes(Span<byte> output):void  
NextBytesAsync(ArraySegment<byte> output):Task
NextBytesAsync(byte[] output):Task

NextRange(int minVal, int maxVal):int
NextRangeAsync(int minVal, int maxVal):Task<int>

NextRange(long minVal, long maxVal):long
NextRangeAsync(long minVal, long maxVal):Task<long>

NextRange(Int128 minVal, Int128 maxVal):Int128
NextRangeAsync(Int128 minVal, Int128 maxVal):Task<Int128>

NextRange(BigIntBitLen bitLen, BigInteger minVal, BigInteger maxVal):BigInteger
NextRangeAsync(BigIntBitLen bitLen, BigInteger minVal, BigInteger maxVal):Task<BigInteger>

FillRange(Span<int> output, int minVal, int maxVal):void
FillRangeAsync(int[] output, int minVal, int maxVal):Task
FillRangeAsync(ArraySegment<int> output, int minVal, int maxVal):Task

FillRange(Span<long> output, long minVal, long maxVal):void
FillRangeAsync(long[] output, long minVal, long maxVal):Task
FillRangeAsync(ArraySegment<long> output, long minVal, long maxVal):Task

FillRange(Span<BigInteger> output, BigIntBitLen bitLen, BigInteger minVal, BigInteger maxVal):void
FillRangeAsync(BigInteger[] output, BigIntBitLen bitLen, BigInteger minVal, BigInteger maxVal):Task
FillRangeAsync(ArraySegment<BigInteger> output, BigIntBitLen bitLen, BigInteger minVal, BigInteger maxVal):Task

FillRange(Span<Int128> output, Int128 minVal, Int128 maxVal):void
FillRangeAsync(Int128[] output, Int128 minVal, Int128 maxVal):Task
FillRangeAsync(ArraySegment<Int128> output, Int128 minVal, Int128 maxVal):Task

LoadBytes(Span<byte> output, ReadOnlySpan<uint> kernel, Locale locale, NumRounds rounds):Locale
LoadBytesAsync(ArraySegment<byte> output, uint[] kernel, Locale locale, NumRounds rounds):Task<Locale>
LoadBytesAsync(byte[] output, uint[] kernel, Locale locale, NumRounds rounds):Task<Locale>

Shuffle<T>(Span<T> buffer):void
ShuffleAsync<T>(T[] buffer):Task


  • Coming soon.


Install with NuGet Package Manager Console

Install-Package GoeaLabs.Chaos

Install with .NET CLI

dotnet add package GoeaLabs.Chaos
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on GoeaLabs.Chaos:

Package Downloads
GoeaLabs.Hydra The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Hydra Encryption Cipher for .NET.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.4.0-rc.1 88 5/23/2023
0.3.0-rc.1 63 5/21/2023
0.2.0-rc.1 63 5/19/2023
0.1.0-rc.1 71 5/2/2023