What is a Hash?

HashA hash, also called a digest, is a unique string of data.  A hash is created when a collection of information that you want to protect is run through a hash function.  The process of creating a hash is called hashing.  The resulting hash is unique to the original message and therefore can be used fingerprint of that data.

Since a hash creates an identifiable signature of data it can be used to determine whether a set of data has been changed; in other words it is possible to verify the integrity of data.  For example, you want to make sure that financial documents that you have stored have not been tampered with, so you create a hash of the known correct data. Now, whenever you want to check the data, you simply hash the data again and the two hashes should match if the most current data has not been changed.

When sending critical data the message along with a hash of the message is usually sent to recipients.  The recipient can then verify that the message has not been altered.  One of the main benefits of hashing is that the integrity of a message can be checked without revealing the contents of the original message.

Hashes are also called one-way hashes because once they are created they cannot be reversed.  This means that a hash cannot be deciphered to determine the contents of the original message.  Therefore hashes can only be used to compare data.

Hashes are created with Hash functions, which are cryptographic algorithms.  An algorithms that is considered secure should not create collisions meaning two different sets of data creating the same hash value.  In addition, a secure hash algorithm should create hashes that are the same length no matter the size of data being hashed.  One of the advantages of a fixed length hash is that other programs can use it easily since it is consistent.

Two common cryptographic algorithms are Message Digest (MD) and Secure Hash Algorithm (SHA).  The Message Digest algorithm has several versions; the most current version is MD5.  MD5 is the default procedure for Simple Network Management Protocol (SNMP). However, researchers have revealed collisions and vulnerabilities in the MD5 code and a more secure cryptographic algorithm is recommended for hashing.

Secure Hash Algorithm (SHA) creates a longer hash than most versions of MD resulting in a more secure code.  Currently there have been no weaknesses found with the most recent version of SHA, SHA-2.  Another version, SHA-3, is in development and scheduled to be complete in 2012.

A practical application of a hash function is ensuring that data transmissions are correct.  When packets are sent across networks errors often occur.  Many times when a program is available on a website for download, a hash function is also available to verify that the downloaded file is identical to the file on the site.  Using Hashes to check files for errors is similar to a checksum or Cyclic Redundancy Check (CRC), which is shorter and less secure than a hash.

Bookmark and Share

This entry was posted on Thursday, July 15th, 2010 at 7:14 am and is filed under Computer Security, Cryptography. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “What is a Hash?”

  1. MD5 Hash Says:

    Very good explanation. I find too many sw developers store sensitive info in plain text. A shame, when it’s so easy to md5 something.

Leave a Reply