Home

Awesome

SharpHash License Build Status Nuget Nuget

SharpHash is a C# hashing library that provides a fluent interface for computing hashes and checksums of strings, files, streams, bytearrays and untyped data to mention but a few.

It also supports Incremental Hashing, Cloning, NullDigest and HashName Builder.

Available Algorithms

Hashes


Cyclic Redundancy Checks
Checksums
Non-Cryptographic Hash Functions

32 bit hashes
64 bit hashes
128 bit hashes
Cryptographic Hash Functions

Key Derivation Functions


Password Hashing Schemes (Password Based Key Derivation Functions)

MAC


XOF (Extendable Output Function)


Usage Examples


using SharpHash.Base;
using SharpHash.Interfaces;
using System;
using System.Text;

namespace Program
{
    public class Hello 
    {
	public static void Main() 
	{
	    // Chaining mode
	    string result = HashFactory.Crypto.CreateMD5()
	    			.ComputeString("Hello C#", Encoding.UTF8).ToString();

	    // Incremental mode
	    IHash hash = HashFactory.Crypto.CreateMD5();
	    hash.Initialize();
	    hash.TransformString("Hello", Encoding.UTF8);
	    hash.TransformString(" C#", Encoding.UTF8);
	    string result_2 = hash.TransformFinal().ToString();

	    bool check = result == result_2;
	
	    // Using the HashName Builder variation
	    IHash hash_builder = HashFactory.CreateHash("md5");
	    string result_3 = hash_builder.ComputeString("Hello C#", 
				Encoding.UTF8).ToString();
	    bool check_2 = result == result_3;
	}
    }
}

Other Implementations


If you want implementations in other languages, you can check out these

Tip Jar