⛔️ [DEPRECATED] Please use Blake2b.Net as a replacement.
Implementation of the cryptographic hash, and mac functions of BLAKE2b. Optimized for PinnedMemory, and 64-bit platforms.
From a command prompt
dotnet add package Blake2b.NetCore
Install-Package Blake2b.NetCore
You can also search for package via your nuget ui / website:
https://www.nuget.org/packages/Blake2b.NetCore/
You can find more examples in the github examples project.
Hash:
var digest = new Blake2b();
using var exampleHash = new PinnedMemory<byte>(new byte[digest.GetLength()]);
digest.UpdateBlock(new PinnedMemory<byte>(new byte[] {63, 61, 77, 20, 63, 61, 77, 20, 63, 61, 77}, false), 0, 11);
digest.DoFinal(exampleHash, 0);
Mac:
var digest = new Blake2bMac(new PinnedMemory<byte>(new byte[] {63, 61, 77, 20, 63, 61, 77}, false));
using var exampleHash = new PinnedMemory<byte>(new byte[digest.GetLength()]);
digest.UpdateBlock(new PinnedMemory<byte>(new byte[] {63, 61, 77, 20, 63, 61, 77, 20, 63, 61, 77}, false), 0, 11);
digest.DoFinal(exampleHash, 0);
Digest size restricted to 160, 256, 384, 512
Blake2b(int digestSize = 512)
Blake2bMac(PinnedMemory<byte> key)
Blake2bMac(PinnedMemory<byte> key, byte[] salt, int digestSize = 512)
Update the message digest with a single byte.
void Update(byte b)
Update the message digest with a pinned memory byte array.
void UpdateBlock(PinnedMemory<byte> message, int offset, int len)
Update the message digest with a byte array.
void UpdateBlock(byte[] message, int offset, int len)
Produce the final digest value outputting to pinned memory. Key & salt remain until dispose is called.
void DoFinal(PinnedMemory<byte> output, int outOffset)
Reset the digest back to it's initial state for further processing. Key & salt remain until dispose is called.
void Reset()
Clear key & salt, reset digest back to it's initial state.
void Dispose()