Skip to content
A basic C sharp library to help you hash quickly and conveniently
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Making Hashing Simpler in C Sharp
Version  Downloads  Licence  Build  Issues 


This is a simple project in which it make hashing simpler and cleaner in your own code bases. This is not intended to be a complex project however it may grow in the next period.


EasyHash comes with an Interface (Midnite81.EasyHash.Contracts.IHasher) should you wish to bind it with the concrete class (Midnite81.EasyHash.Hasher).

Creating a Hash

To make the hashing process more secure the Salt, unless specified, is randomly generated to make the process more secure.

public void CreateAHash()
    var hasher = new Hasher();

    Hash generatedHash = hasher.MakeHash("password");
    // you will need to save both the hash string and salt string to the database, 
    // so that when you come to check them you're able to pass both to the verify function

Generating a salt

public void GenerateSalt()
    var hasher = new Hasher();

     Salt generatedSalt = hasher.GenerateSalt(24);
    // returns Salt
    // generatedSalt.String is the base64 string you can store in the database should you wish
    // generatedSalt.Bytes is the array of bytes which form the salt

Verifying a hash

public void CheckHashesMatch()
    var hasher = new Hasher();

    byte[] salt = hasher.ConvertStringToBytes(GetUsersSaltFromDatabase());
    byte[] hash = hasher.ConvertStringToBytes(GetUsersHashFromDatabase());

    bool compare = hasher.VerifyHash("password_I_want_to_check", salt, hash);

    if (compare)
        // they matched
        // they didn't match
You can’t perform that action at this time.