Argon2.NetCore
1.0.0
See the version list below for details.
dotnet add package Argon2.NetCore --version 1.0.0
NuGet\Install-Package Argon2.NetCore -Version 1.0.0
<PackageReference Include="Argon2.NetCore" Version="1.0.0" />
paket add Argon2.NetCore --version 1.0.0
#r "nuget: Argon2.NetCore, 1.0.0"
// Install Argon2.NetCore as a Cake Addin #addin nuget:?package=Argon2.NetCore&version=1.0.0 // Install Argon2.NetCore as a Cake Tool #tool nuget:?package=Argon2.NetCore&version=1.0.0
Argon2.NetCore
Implementation of Argon2 key derivation function designed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich. Optimized for PinnedMemory.
Install
From a command prompt
dotnet add package Argon2.NetCore
Install-Package Argon2.NetCore
You can also search for package via your nuget ui / website:
https://www.nuget.org/packages/Argon2.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 argon2 = new Argon2(keyPin, iv)
{
Addressing = Argon2.AddressType.DependentAddressing,
HashLength = 64,
MemoryCost = 65536,
Lanes = 4,
Threads = 2,
TimeCost = 3
};
argon2.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 hash = new PinnedMemory<byte>(new byte[argon2.GetLength()]);
argon2.DoFinal(hash, 0);
Constructor
Argon2(PinnedMemory<byte> key, byte[] salt, byte[] associatedData = null)
Options
HashLength
Length of hash to output, typically 32, 64.
Lanes
Parallelism number of parallel threads, typically 4, or number of cpu cores.
Threads
Number of threads to spawn in relation to parallelism. This is typically 1, or number of cpu cores.
MemoryCost
Amount of memory (in kibibytes) to use. The more that's used the harder it may be for GPU's to process.
TimeCost
Amount of interations to use. The more that's used the harder it may be for CPU's to process.
Methods
Get the hash output length.
int GetLength()
Update the hash with a single byte.
void Update(byte input)
Update the hash with a pinned memory byte array.
void UpdateBlock(PinnedMemory<byte> input, int inOff, int len)
Update the hash with a byte array.
void UpdateBlock(byte[] input, int inOff, int len)
Produce the final hash outputting to pinned memory. Key & salt remain until dispose is called.
void DoFinal(PinnedMemory<byte> output, int outOff)
Reset the hash back to it's initial state for further processing. Key & salt remain until dispose is called.
void Reset()
Clear key & salt, reset hash back to it's initial state.
void Dispose()
Product | Versions 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. |
-
.NETCoreApp 3.1
- Blake2b.NetCore (>= 1.0.1)
- PinnedMemory (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.