System.IO.Hashing 9.0.4

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package System.IO.Hashing --version 9.0.4
                    
NuGet\Install-Package System.IO.Hashing -Version 9.0.4
                    
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="System.IO.Hashing" Version="9.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="System.IO.Hashing" Version="9.0.4" />
                    
Directory.Packages.props
<PackageReference Include="System.IO.Hashing" />
                    
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 System.IO.Hashing --version 9.0.4
                    
#r "nuget: System.IO.Hashing, 9.0.4"
                    
#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.
#addin nuget:?package=System.IO.Hashing&version=9.0.4
                    
Install System.IO.Hashing as a Cake Addin
#tool nuget:?package=System.IO.Hashing&version=9.0.4
                    
Install System.IO.Hashing as a Cake Tool

About

System.IO.Hashing offers a variety of hash code algorithms.

Hash code algorithms are pivotal for generating unique values for objects based on their content, facilitating object comparisons, and detecting content alterations. The namespace encompasses algorithms like CRC-32, CRC-64, xxHash3, xxHash32, xxHash64, and xxHash128, all engineered for swift and efficient hash code generation, with xxHash being an "Extremely fast hash algorithm".

Warning: The hash functions provided by System.IO.Hashing are not suitable for security purposes such as handling passwords or verifying untrusted content. For such security-critical applications, consider using cryptographic hash functions provided by the System.Security.Cryptography namespace.

Key Features

  • Variety of hash code algorithms including CRC-32, CRC-64, xxHash3, xxHash32, xxHash64, and xxHash128.
  • Implementations of CRC-32 and CRC-64 algorithms, as used in IEEE 802.3, and described in ECMA-182, Annex B respectively.
  • Implementations of XxHash32 for generating 32-bit hashes, XxHash3 and XxHash64 for generating 64-bit hashes, and xxHash128 for generating 128-bit hashes.

How to Use

Creating hash codes is straightforward. Call the Hash method with the content to be hashed.

Here is a practical example:

using System;
using System.IO.Hashing;

byte[] data = new byte[] { 1, 2, 3, 4 };

byte[] crc32Value = Crc32.Hash(data);
Console.WriteLine($"CRC-32 Hash: {BitConverter.ToString(crc32Value)}");
// CRC-32 Hash: CD-FB-3C-B6

byte[] crc64Value = Crc64.Hash(data);
Console.WriteLine($"CRC-64 Hash: {BitConverter.ToString(crc64Value)}");
// CRC-64 Hash: 58-8D-5A-D4-2A-70-1D-B2

byte[] xxHash3Value = XxHash3.Hash(data);
Console.WriteLine($"XxHash3 Hash: {BitConverter.ToString(xxHash3Value)}");
// XxHash3 Hash: 98-8B-7B-90-33-AC-46-22

byte[] xxHash32Value = XxHash32.Hash(data);
Console.WriteLine($"XxHash32 Hash: {BitConverter.ToString(xxHash32Value)}");
// XxHash32 Hash: FE-96-D1-9C

byte[] xxHash64Value = XxHash64.Hash(data);
Console.WriteLine($"XxHash64 Hash: {BitConverter.ToString(xxHash64Value)}");
// XxHash64 Hash: 54-26-20-E3-A2-A9-2E-D1

byte[] xxHash128Value = XxHash128.Hash(data);
Console.WriteLine($"XxHash128 Hash: {BitConverter.ToString(xxHash128Value)}");
// XxHash128 Hash: 49-A0-48-99-59-7A-35-67-53-76-53-A0-D9-95-5B-86

Main Types

The main types provided by this library are:

  • System.IO.Hashing.Crc32
  • System.IO.Hashing.Crc64
  • System.IO.Hashing.XxHash3
  • System.IO.Hashing.XxHash32
  • System.IO.Hashing.XxHash64
  • System.IO.Hashing.XxHash128

Additional Documentation

Cryptographic services, including secure encryption and decryption of data: System.Security.Cryptography

Feedback & Contributing

System.IO.Hashing is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Product 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 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (269)

Showing the top 5 NuGet packages that depend on System.IO.Hashing:

Package Downloads
Azure.Storage.Common

This client library enables working with the Microsoft Azure Storage services which include the blob and file services for storing binary and text data, and the queue service for storing messages that may be accessed by a client. For this release see notes - https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Common/README.md and https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Common/CHANGELOG.md in addition to the breaking changes https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Azure.Storage.Common/BreakingChanges.txt Microsoft Azure Storage quickstarts and tutorials - https://docs.microsoft.com/en-us/azure/storage/ Microsoft Azure Storage REST API Reference - https://docs.microsoft.com/en-us/rest/api/storageservices/

Yarp.ReverseProxy

Reverse proxy toolkit for building fast proxy servers in .NET using the infrastructure from ASP.NET and .NET

Microsoft.Orleans.Core

Core library of Microsoft Orleans used both on the client and server.

Microsoft.Orleans.Core.Abstractions

Core abstractions library of Microsoft Orleans

Verify

Enables verification of complex models and documents.

GitHub repositories (62)

Showing the top 20 popular GitHub repositories that depend on System.IO.Hashing:

Repository Stars
files-community/Files
A modern file manager that helps users organize their files and folders.
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
dotnet/orleans
Cloud Native application framework for .NET
dotnet/yarp
A toolkit for developing high-performance HTTP reverse proxy applications.
babalae/better-genshin-impact
📦BetterGI · 更好的原神 - 自动拾取 | 自动剧情 | 全自动钓鱼(AI) | 全自动七圣召唤 | 自动伐木 | 自动刷本 | 自动采集/挖矿/锄地 | 一条龙 | 全连音游 - UI Automation Testing Tools For Genshin Impact
OrchardCMS/OrchardCore
Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
SixLabors/ImageSharp
:camera: A modern, cross-platform, 2D Graphics library for .NET
LykosAI/StabilityMatrix
Multi-Platform Package Manager for Stable Diffusion
Azure/azure-sdk-for-net
This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
dotnet/winforms
Windows Forms is a .NET UI framework for building Windows desktop applications.
DGP-Studio/Snap.Hutao
实用的开源多功能原神工具箱 🧰 / Multifunctional Open-source Genshin Impact Toolkit 🧰
dotnet/aspire
Tools, templates, and packages to accelerate building observable, production-ready apps
neo-project/neo
NEO Smart Economy
VerifyTests/Verify
Verify is a snapshot testing tool that simplifies the assertion of complex data models and documents.
Revolutionary-Games/Thrive
The main repository for the development of the evolution game Thrive.
dotnet/sdk
Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
SteamRE/SteamKit
SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.
dotnet/android
.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
ValveResourceFormat/ValveResourceFormat
🔬 Valve's Source 2 resource file format parser, decompiler, and exporter.
dotnet/dotNext
Next generation API for .NET
Version Downloads Last updated
10.0.0-preview.2.25163.2 522 3/18/2025
10.0.0-preview.1.25080.5 939 2/25/2025
9.0.4 197 4/8/2025
9.0.3 281,450 3/11/2025
9.0.2 425,820 2/11/2025
9.0.1 682,900 1/14/2025
9.0.0 1,368,360 11/12/2024
9.0.0-rc.2.24473.5 22,588 10/8/2024
9.0.0-rc.1.24431.7 6,860 9/10/2024
9.0.0-preview.7.24405.7 2,634 8/13/2024
9.0.0-preview.6.24327.7 11,741 7/9/2024
9.0.0-preview.5.24306.7 2,140 6/11/2024
9.0.0-preview.4.24266.19 3,220 5/21/2024
9.0.0-preview.3.24172.9 17,551 4/11/2024
9.0.0-preview.2.24128.5 2,054 3/12/2024
9.0.0-preview.1.24080.9 1,152 2/13/2024
8.0.0 19,513,041 11/14/2023
8.0.0-rc.2.23479.6 11,065 10/10/2023
8.0.0-rc.1.23419.4 5,583 9/12/2023
8.0.0-preview.7.23375.6 3,916 8/8/2023
8.0.0-preview.6.23329.7 14,337 7/11/2023
8.0.0-preview.5.23280.8 18,986 6/13/2023
8.0.0-preview.4.23259.5 5,192 5/16/2023
8.0.0-preview.3.23174.8 33,548 4/11/2023
8.0.0-preview.2.23128.3 1,181 3/14/2023
8.0.0-preview.1.23110.8 6,298 2/21/2023
7.0.0 26,935,957 11/7/2022
7.0.0-rc.2.22472.3 10,703 10/11/2022
7.0.0-rc.1.22426.10 1,516 9/14/2022
7.0.0-preview.7.22375.6 8,730 8/9/2022
7.0.0-preview.6.22324.4 499 7/12/2022
7.0.0-preview.5.22301.12 476 6/14/2022
7.0.0-preview.4.22229.4 632 5/10/2022
7.0.0-preview.3.22175.4 509 4/13/2022
7.0.0-preview.2.22152.2 416 3/14/2022
7.0.0-preview.1.22076.8 418 2/17/2022
6.0.2 1,107,253 9/13/2022
6.0.1 1,122,981 2/8/2022
6.0.0 215,727,120 11/8/2021
6.0.0-rc.2.21480.5 521 10/12/2021
6.0.0-rc.1.21451.13 420 9/14/2021
6.0.0-preview.7.21377.19 1,551 8/10/2021
6.0.0-preview.6.21352.12 1,213 7/14/2021