Thursday, December 13, 2018

Understanding hash algorithms, message digest and rainbow tables

Encryption uses a key or a pair of keys to encrypt and decrypt a message. A hash is different because it is one way. You cannot generate the original message from a hash. We use hash in a number of application including authenticating a message, monitoring data integrity and storing passwords. A hash takes a variable length input and generates a fixed length output depending on the algorithm and the compression used. There is a certain cryptographic requirement for a hash algorithm, these include the ability to apply to any size block of data, to the ability to create a fixed-size output, it is easy to compute and it has a strong collision resistance. Strong collision resistance means no two hashes will be the same.

There two popular hash algorithm, these include:

SHA (Secure Hash Algorithm) which is produced by NIST and can produce a hash value of 160 bits and uses very frequently on the internet.

MD5 (Message Digest Algorithm) is a widely used cryptographic hash that produces a hash value of 128 bits. There software out there that can generate hashes and preserve integrity. See example below

We are going to use gfsw to look at the hash value of a file. First I am going to create a file using a word program then I will use gfsw to look at the hash file and I am going to modify the word document and look at the hash again to compare if they are different.




As you can see the MD5 hash is different from each other. This allows us to know that the integrity of the file has been changed.

Rainbow Table is a database of every possible hashed password generated. If you have the hash, you can match it against the database and you will have the password. Many network penetration tester rely on Rainbow Table to discover weak password on a network



0 comments:

Post a Comment