Secure digest functions

Mohamed Thasneem
4 min readJul 29, 2020

--

what are the hash algorithm and types?

A hash algorithm is a function that converts a data string into a numeric string output of fixed length. The output string is generally much smaller than the original data.

MD5 Algorithm

MD5 message-digest algorithm is the 5th version of the Message-Digest Algorithm developed by Ron Rivest to produce 128-bit message digest. MD5 is quite fast than other versions of message digest which takes the plain text of 512-bit blocks which is further divided into 16 blocks, each of 32 bit and produces the 128-bit message digest which is a set of four blocks, each of 32 bits. MD5 produces the message digest through five steps i.e. padding, append length, divide input into 512-bit blocks, initialize chaining variables a process blocks and 4 rounds, use different constant it in each iteration.

Use of MD5 Algorithm

It was developed with the main motive of security as it takes an input of any size and produces an output if a 128-bit hash value. To be considered cryptographically secure MD5 should meet two requirements:

  1. It is impossible to generate two inputs that cannot produce the same hash function.
  2. It is impossible to generate a message having the same hash value.

Eg: —

Input: This is an article about the MD5 algorithm.

Output: e4d909c290dfb1ca068ffaddd22cbb0

SHA Algorithm

SHA algorithm is Secure Hash algorithm developed by National Institute of Standards and Technology along with NSA, previously released as a Federal Information Processing Standard, later in 1995, it was named as SHA algorithm, design to modify the MD4, in other words, we can say that the SHA algorithm is the modified version of MD4. SHA is designed to obtain the original message, given its message digest and to find the message producing the same message digest.

Uses of SHA Algorithm

These SHA algorithms are widely used in security protocols and applications including the ones such as TLS, PGP, SSL, IPsec, and S/MiME. These also find their place in all the majority of cryptanalytic techniques and coding standards which is mainly aimed to see the functioning and working of majorly all governmental as well as private organizations and institutions. Major giants today such as Google, Microsoft or Mozilla have started to recommend the use of SHA-3 and stop the usage of the SHA-1 algorithm.

Types of SHA Algorithum

1. SHA-0

It is a retronym that is applied to the basic version of the year-old 160 bit or 20-byte long hash function which was published back in 1993 with the name of the SHA algorithm. It was withdrawn very shortly after it was published due to a major flaw and therefore SHA-1 came into the picture.

2. SHA-1

It is a 160 bit or a 20-byte long hash-based function-based encryption mechanism that is used to resemble the year-old MD5 algorithm. The particular algorithm was designed and developed by the NSA i.e. the National Security Agency and was supposed to be the part of the critical component- Digital Signature Algorithm (DSA). The weaknesses which were related to the cryptographic techniques were found in SHA-1 and therefore the encryption standard was later on discarded and was not much put to use.

3. SHA-2

This forms a family of 2 identical hash functions which consist of differently sized block sizes which are known to be SHA-512 and SHA-256 which differ mainly in the word size. The former one consists of the word value range of 32 words whereas the latter one consists of the 64-bit word value. The truncated versions of these values are the ones such as SHA-224, SHA-384 and SHA-512 and SHA-224 or SHA-256.

4. SHA-3

The length supported is the same as that of SHA-2 but the majority of the difference lies in the fact that this one is structurally different as it is based on a wide range of random function generation which typically supports all random permutations and thereby allowing inputting or absorbing, as it is called, any amount of data presented and outputting or squeezing the presented data. While doing all this, this acts as a pseudorandom function for all the inputs provided which therefore leads to greater flexibility.

MD5 vs SHA

Thank You !.

--

--

No responses yet