Language: EN

csharp-hash-black3

How to use the Blake3 hash in C#

Blake3.NET is a library for .NET that allows us to use the cryptographic hash BLAKE3 from an application written in C#.

The Blake3 hash is a modern cryptographic hash algorithm designed to achieve high performance and a low probability of collisions. It is very suitable, for example, for comparing file contents.

Blake3.NET is a wrapper around the Rust implementation of BLAKE3, which uses a parallel design to take full advantage of modern hardware resources, such as SIMD instructions.

The Blake3 hash algorithm produces a 256-bit hash value, but it is also capable of generating hash values of any desired size. This makes it a versatile and flexible tool for various applications.

Blake3.NET is compatible with .NET 5 or higher, and is available for Windows, Linux, and macOS, on x86, x64, or Arm architectures.

How to use Blake3.NET

We can easily add the library to a .NET project through the corresponding Nuget package.

Install-Package Blake3

Here are some examples of how to use Blake3.NET extracted from the library’s documentation

var hash = Blake3.Hasher.Hash(Encoding.UTF8.GetBytes("BLAKE3"));
Console.WriteLine(hash);
// Prints f890484173e516bfd935ef3d22b912dc9738de38743993cfedf2c9473b3216a4