A comprehensive .NET API for well-known hash algorithms.
$ dotnet add package HashifyNETHashifyNET is a C# library designed to offer a common interface for a wide range of cryptographic and non-cryptographic hashing algorithms, while also providing built-in implementations of numerous well-known hash functions.
All functionality of the library is tested using xUnit. A primary requirement for each release is 100% code coverage by these tests. All code within the library is commented using Visual Studio-compatible XML comments.
You can join our Discord at https://discord.gg/PrKery9 any time you'd need support or just to join our Family.
The following hash functions have been implemented from the most reliable reference that could be found:
This library is the successor to https://github.com/Deskasoft/Data.HashFunction. While keeping the API structure mostly the same, the biggest change this library brings is the clearance of the dependency overhaul previously caused by Data.HashFunction. Every hash algorithm is now collected under one single assembly and package named HashifyNET, and all of the namespaces are shortened to HashifyNet.
The former factory-based implementation, which assigned a unique factory to each hash function, has been superseded by a more modular and centralized factory. This new model provides superior accessibility and efficiency.
As an addition, we introduced 11 more hash algorithms, sorted below:
You can directly bind HashifyNET to your project through NuGet below:
Usage for all hash functions has been further standardized and is now accessible through the HashifyNet.HashFactory class.
The HashifyNet.HashFactory class supports both generics and with access to each hash function via System.Type.
To access a hash function via generics, you can do this:
using System;
using HashifyNet;
using HashifyNet.Algorithms.Adler32;
public class Program
{
static void Main()
{
IAdler32 adler32 = HashFactory<IAdler32>.Instance.Create();
IHashValue computedHash = adler32.ComputeHash("foobar");
Console.WriteLine(computedHash.AsHexString());
}
}To access a hash function via System.Type, you can do this:
using System;
using HashifyNet;
using HashifyNet.Algorithms.Adler32;
public class Program
{
static void Main()
{
IHashFunctionBase adler32 = HashFactory.Instance.Create(typeof(IAdler32));
IHashValue computedHash = adler32.ComputeHash("foobar");
Console.WriteLine(computedHash.AsHexString());
}
}There are a lot more changes made to the library, and feel free to explore them by adding to your project. We'd love to see what you are going to do or have done with our library, so feel free to share them with us at https://discord.gg/PrKery9.
This library generally abides by Semantic Versioning. Packages are published in MAJOR.MINOR.PATCH version format.
An increment of the PATCH component always indicates that an internal-only change was made, generally a bug fix. These changes will not affect the public-facing API in any way, and are always guaranteed to be forward/backwards-compatible with your codebase, any pre-compiled dependencies of your codebase.
An increment of the MINOR component indicates that some addition was made to the library, and this addition may not be backwards-compatible with prior versions.
An increment of the MAJOR component indicates that breaking changes have been made to the library; Consumers should check the release notes to determine what changes need to be made.
Feel free to propose changes, notify of issues, or contribute code using GitHub! Submit issues and/or pull requests as necessary.
There are no special requirements for change proposals or issue notifications.
Code contributions should follow the existing code's methodologies and style, along with XML comments for all public and protected namespaces, classes, and functions added.
HashifyNET is released under the terms of the MIT license. See LICENSE for more information or see http://opensource.org/licenses/MIT.