This project is read-only.

Hashing (Cryptosolic.Security.Hashing)

Hashing Overview

Hashing is the process for creating a unique and repeatable digital fingerprint for a given piece of data. Although the output of a hashing algorithm prevents the original data from being human readable, hashing is not encryption. Hashing is a one way process; i.e. once the data has been hashed, there is no way of converting or decrypting it back to a human readable form.

The following diagram shows a typical authentication scenario, in which hashing is used to protect user passwords.

Hashing Example.png

Because there is no way of decrypting the hash, the only person that knows the password is the user who created it; even the DBA is unable to retrieve the password as it is stored in the database in a non human readable form.

Hashing Providers

Cryptosolic currently supports the following Hashing Providers:

Hashing Provider Output Length
MD5 128 bits
SHA1 160 bits
SHA256 256 bits
SHA384 384 bits
SHA512 512 bits

The following example illustrates the different outputs for the various Hashing Algorithms, based on a common string input:

Cryptosolic Hashing Example.png

The longer the output string, the more secure the hash is; however bigger hashes take longer to compute. There is a trade off between speed and security.

For more information on Hashing Providers, checkout this Wikipedia article:

Hashing Tutorial

In order to use the hashing features of Cryptosolic, first make sure that you create a reference to the Cryptosolic.Security binary, and use the appropriate namespaces in your code:

using Cryptosolic.Security;
using Cryptosolic.Security.Hashing;

Then simply instantiate the relevant hashing algoritm (see table above), and call the 'HashData()' method, passing it the human readable data that is to be hashed.

IHashingAlgorithm hashAlg = new Sha512();
CipherText hashedText = hashAlg.HashData("Please Hash Me");

The hashed data is stored in an instance of 'CipherText', and can be read as a Hex string or a Byte array.

Last edited May 18, 2014 at 12:50 AM by pipjt, version 32