# Secure Digest Functions

The Cryptographic Algorithms have three categories such as Symmetric Key cryptographic , Asymmetric key cryptographic and Digest function.

When topic is security, Hashing and Encryption are words that hears all the time. so In this blog, I’ll discuss about digest function, also known as Hash Function. The hash functions play an important role in modern communication technology. It is using a special cryptographic function to transform one set of data into another of fixed length by using a mathematical process. The process involves mapping data of any size to a fixed length using a hash table and then storing the output data in the digest.

If we want to send an encrypted file, we will first calculate the file hash. Then we will encrypt the file along with the generated hash number and send it to the recipient. The recipient will decrypt the file and calculate his hash number. If both hashes are the same there is very high probability that message has not been tampered by third party.

A cryptographic Digest function must satisfy three criteria:

1. Preimage resistance: It is about the most basic property of a hash function which can be thought. It means:-

For a given h in the output space of the hash function, it is hard to find any message x with H(x)=h.

2. Second preimage resistance: It is the property of a hash function which computationally infeasible to find any second input that has the same output as a given input.

For a given message x it is hard to find a second message y≠x with H(x)=H(y).

3. Strong collision resistance: This property means it should be hard to find two different inputs of any length that result in the same hash. This property is also referred to as collision free hash function.

It is hard to find a pair of messages x1≠x2 with H(x1)=H(x2)

digest functions are also called one-way hash functions because they produce values that are difficult to invert, resistant to attack, effectively unique, and widely distributed. Here some popular functions:- MD2, MD4, MD5 and SHA, SHA-1, SHA-256,384,512.

MD5

MD5 stands for Message Digest. It is a type of algorithm that is known as a cryptographic hash algorithm.It developed by Ronald Rivest and It produces a 128-bit digest such as hash value in a hexadecimal format. This competes with other designs where hash functions take in a certain piece of data, and change it to provide a key or value that can be used in place of the original value.

SHA-1

SHA1 stands for Secure Hash Algorithm. It was created by the US National Security Agency in 1995 and it is part of the Digital Signature Algorithm. It produces a 160-bit digests from the inputted data, which resembles the hash value of the MD5 algorithm.

Some of the protocols that use SHA-1 include:

• Transport Layer Security (TLS)

Let’s hash a short phrase to demonstrate what happens with only a minor change. For this exercise, we’ll use SHA1.

Go Steelers!

SHA1: c924 4cac 47b3 4335 5aed 06f3 cc85 ea82 885f 9f3e

Now let’s change the “S” from upper case to lower case. the output is

Go steelers!

SHA1: 1a10 ffd1 db12 c88f 88e6 b070 561f 6124 f632 26ec

Note the drastic change in the resulting hash values.As you can see, small changes make a big difference.

Final year Software Engineering Student at University of Kelaniya.

## More from Sharmila Pararajasingam

Final year Software Engineering Student at University of Kelaniya.