StreamHash 1.11.2

dotnet add package StreamHash --version 1.11.2
                    
NuGet\Install-Package StreamHash -Version 1.11.2
                    
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="StreamHash" Version="1.11.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StreamHash" Version="1.11.2" />
                    
Directory.Packages.props
<PackageReference Include="StreamHash" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StreamHash --version 1.11.2
                    
#r "nuget: StreamHash, 1.11.2"
                    
#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.
#:package StreamHash@1.11.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StreamHash&version=1.11.2
                    
Install as a Cake Addin
#tool nuget:?package=StreamHash&version=1.11.2
                    
Install as a Cake Tool

StreamHash

CI NuGet NuGet Downloads License: Unlicense .NET

StreamHash is a high-performance, memory-efficient streaming hash library for .NET 10+. All 70 hash algorithms are implemented natively in pure C# with zero heavy dependencies β€” just one lightweight package (System.IO.Hashing) for CRC/xxHash acceleration.

🎯 Why StreamHash?

  • Single package, all algorithms: One NuGet install gives you 70 hash algorithms β€” no BouncyCastle, no native binaries, no transitive dependency hell
  • Streaming everything: Many popular algorithms (MurmurHash, CityHash, SpookyHash, etc.) lack streaming APIs. Hashing a 10GB file normally requires 10GB of RAM! StreamHash processes data in chunks using ~16MB regardless of file size
  • Competitive performance: Native C# implementations match or beat external libraries for most algorithms β€” see benchmarks

✨ Features

  • πŸš€ Memory Efficient: Hash multi-gigabyte files with minimal memory footprint
  • ⚑ High Performance: Optimized implementations with SIMD where available (GrΓΈstl AES-NI, JH SSSE3, HighwayHash AVX2, BLAKE2b AVX2, CRC-32C SSE4.2)
  • πŸ”„ Streaming API: Process data incrementally with Update() and Finalize()
  • πŸ“¦ Zero Allocations: Hot paths are allocation-free using Span<T>
  • 🎯 Unified API: HashFacade provides access to all 70 algorithms through a single interface
  • πŸ” All-Native Crypto: Every cryptographic algorithm implemented in pure C# β€” no BouncyCastle dependency
  • ⚑ Batch Streaming: Process 70 algorithms in parallel with CreateAllStreaming()
  • πŸ§ͺ Thoroughly Tested: 1853+ tests validating against official test vectors
  • πŸ“¦ Minimal Dependencies: Only System.IO.Hashing β€” no large transitive dependency chains

πŸš€ Quick Start

Installation

dotnet add package StreamHash --version 1.11.2

One-Shot Hashing (Simplest)

using StreamHash.Core;

byte[] data = File.ReadAllBytes("file.bin");

// Compute a single hash
string hex = HashFacade.ComputeHashHex(HashAlgorithm.Sha256, data);
byte[] hash = HashFacade.ComputeHash(HashAlgorithm.XxHash64, data);

// Get algorithm info
var info = HashFacade.GetInfo(HashAlgorithm.Sha256);
Console.WriteLine($"{info.DisplayName}: {info.DigestSize} bytes, Crypto: {info.IsCryptographic}");

Streaming a Single Algorithm

For large files that don't fit in memory:

using StreamHash.Core;

using var hasher = HashFacade.CreateStreaming(HashAlgorithm.MurmurHash3_128);
using var stream = File.OpenRead("large-file.bin");

byte[] buffer = new byte[1024 * 1024]; // 1MB buffer
int bytesRead;
while ((bytesRead = stream.Read(buffer)) > 0) {
	hasher.Update(buffer.AsSpan(0, bytesRead));
}

byte[] result = hasher.FinalizeBytes();
string hex = hasher.FinalizeHex();

Batch Streaming β€” All 70 Algorithms at Once

Hash a file with all 70 algorithms in parallel, in a single pass:

using StreamHash.Core;

using var multi = HashFacade.CreateAllStreaming();
using var stream = File.OpenRead("large-file.bin");

byte[] buffer = new byte[16 * 1024 * 1024]; // 16MB buffer recommended
int read;
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) {
	multi.Update(buffer.AsSpan(0, read));
}

Dictionary<string, string> results = multi.FinalizeAll();
// results["SHA256"] = "abc123..."
// results["MD5"] = "def456..."
// ... all 70 algorithms

Basic Hashes β€” The 4 Most Common

For the common case of verifying files with CRC32, MD5, SHA-1, and SHA-256:

using StreamHash.Core;

using var basicHasher = HashFacade.CreateBasicHashesStreaming();
using var stream = File.OpenRead("download.zip");

var buffer = new byte[16 * 1024 * 1024];
int bytesRead;
while ((bytesRead = stream.Read(buffer)) > 0) {
	basicHasher.Update(buffer.AsSpan(0, bytesRead));
}

var results = basicHasher.FinalizeAll();
Console.WriteLine($"CRC32:   {results[HashAlgorithmNames.Crc32]}");
Console.WriteLine($"MD5:     {results[HashAlgorithmNames.Md5]}");
Console.WriteLine($"SHA-1:   {results[HashAlgorithmNames.Sha1]}");
Console.WriteLine($"SHA-256: {results[HashAlgorithmNames.Sha256]}");

Tip: Use HashAlgorithmNames constants instead of string literals to avoid typos!

Direct Type API

You can also instantiate algorithm types directly:

using StreamHash.Core;

using var hasher = new MurmurHash3_128();
hasher.Update(chunk1);
hasher.Update(chunk2);
UInt128 hash = hasher.Finalize();

πŸ“Š Algorithm Support (70 Algorithms)

Category Count Algorithms
Checksums 9 CRC32, CRC32C, CRC64, CRC-16 (CCITT/MODBUS/USB), Adler-32, Fletcher-16, Fletcher-32
Fast Non-Crypto 22 xxHash (32/64/3/128), MurmurHash3 (32/128), CityHash (64/128), FarmHash64, SpookyV2, SipHash, HighwayHash64, MetroHash (64/128), wyhash64, FNV-1a (32/64), DJB2, DJB2a, SDBM, LoseLose
MD Family 3 MD2, MD4, MD5
SHA-1/2 Family 9 SHA-0, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256
SHA-3 & Keccak 6 SHA3-224, SHA3-256, SHA3-384, SHA3-512, Keccak-256, Keccak-512
BLAKE Family 5 BLAKE-256, BLAKE-512, BLAKE2b, BLAKE2s, BLAKE3
RIPEMD Family 4 RIPEMD-128, RIPEMD-160, RIPEMD-256, RIPEMD-320
Other Crypto 12 Whirlpool, Tiger-192, GOST-94, Streebog-256/512, Skein-256/512/1024, GrΓΈstl-256/512, JH-256/512, KangarooTwelve, SM3

All algorithms are implemented in pure native C# with zero true unsafe code.

⚑ Performance Highlights

StreamHash's native C# matches or beats external libraries for most algorithms:

  • 4.9x faster: Whirlpool vs BouncyCastle
  • 2.5x faster: SHA-1 (.NET hardware acceleration)
  • 1.8x faster: RIPEMD-128, Streebog-256
  • At parity: BLAKE3 (matches Rust native!), SHA3 family, CRC, xxHash
  • 20 algorithms faster than BouncyCastle, only 2 meaningfully slower (BLAKE2b/2s with AVX2 SIMD)

Full benchmark data with detailed comparisons at all data sizes: Performance Benchmarks

πŸ“– Documentation

Algorithm Documentation

Category Docs
BLAKE2b/2s blake2.md
BLAKE3 blake3.md
Keccak/SHA-3 keccak-sha3.md
SHA-0/224/512t sha-family.md
MD2/MD4/MD5 md-family.md
RIPEMD family ripemd.md
Skein family skein.md
Whirlpool Whirlpool.md
Tiger-192 tiger.md
SM3 sm3.md
GrΓΈstl groestl.md
JH jh.md
KangarooTwelve kangarootwelve.md
Streebog streebog.md
GOST-94 gost94.md
xxHash family xxhash.md
MetroHash metrohash.md
wyhash wyhash.md
FNV-1a fnv1a.md
CRC-16 crc16.md
MurmurHash3 murmurhash3.md
CityHash cityhash.md
FarmHash farmhash.md
SipHash siphash.md
SpookyHash spookyhash.md
HighwayHash highwayhash.md

πŸ—οΈ Building

git clone https://github.com/TheAnsarya/StreamHash.git
cd StreamHash
dotnet build StreamHash.slnx
dotnet test    # 1853+ tests

πŸ“„ License

This project is released into the public domain under The Unlicense. Do whatever you want with it.

πŸ™ Acknowledgments & References

As of v1.11.0, all 70 algorithms are implemented natively in StreamHash with no external hash library dependencies. The following projects were invaluable as reference implementations and inspiration:

Reference Implementations

  • BouncyCastle.Cryptography β€” Reference for MD2, MD4, SHA-224, SHA-512/224, SHA-512/256, RIPEMD-256/320, GOST-94, Streebog-256/512, Skein-256/512/1024, SM3, BLAKE2b/2s. MIT License.
  • acryptohashnet β€” Reference for Keccak-256/512, RIPEMD-128/160, Tiger-192, SHA-0. MIT License.
  • SauceControl.Blake2Fast β€” BLAKE2 SIMD reference with SSE2-AVX512. MIT License.
  • Blake3.NET β€” BLAKE3 reference (Rust SIMD). Apache 2.0/MIT License.
  • nebulae.dotSHA3 β€” SHA-3 XKCP reference with AVX2/NEON. MIT License.

Algorithm References

  • SMHasher β€” MurmurHash reference implementation
  • CityHash β€” Google's CityHash
  • SpookyHash β€” Bob Jenkins' SpookyHash
  • SipHash β€” Reference SipHash implementation
  • XKCP β€” Keccak/SHA-3 reference implementations
  • RFC 7693 β€” BLAKE2 specification
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.11.2 555 3/18/2026
1.11.1 100 3/17/2026
1.11.0 97 3/16/2026
1.10.0 3,624 2/10/2026
1.8.0 116 2/5/2026
1.7.0 98 2/5/2026
1.6.3 95 2/4/2026
1.6.2 99 2/4/2026
1.6.1 94 2/4/2026
1.6.0 98 2/4/2026
1.3.0 97 2/4/2026
1.2.0 96 2/4/2026

v1.11.2: Fixed benchmark chunk sizes to use realistic I/O sizes. Added chunk-size matrix benchmarks for optimal performance analysis. All 70 algorithms benchmarked with realistic 1MB chunks instead of unrealistic 16MB chunks.