Hello Ninjas, we are back with another article based on Security in Cryptography. We will learn about the comparison between different security criteria in Hash Functions. Let us start with some basic definitions to understand the concepts of security in cryptography.

How will you react if your messages, like passwords, address are visible or accessible to third parties? Of course, you will not feel safe, and that's why your messages are encrypted. Encryption means security and privacy, which are obtained by cryptography.

What is Cryptography

Cryptography is the art of protecting Data and Information in an unreadable format and then retransmitting that message back to its original form. Cryptography allows you to store some sensitive information like passwords and addresses or send it through insecure networks like on the Internet. It uses some codes to protect the data from attacks so that it is in a readable format only for the ones the data is supposed to be.

Cryptography is similar to the Navajo code used by the military. They have symbols for every letter and word that can be used only if both personnel know the language.

Let's see what hash functions are first before moving toward the Security criteria in Hash.

What are Hash Functions

Hash Functions in cryptography are mathematical functions that are used to create secure and authenticated messages.

Hash Functions in cryptography generate a code to check the message's authenticity. In layman's language, we say that any document is hashed (passes through a hash function) to develop a hash value(code) using a hash function in cryptography.

The hash value is also called a message digest.

As discussed in the previous section, we require a message, keys, and function in general to perform any authentication. Hash functions are a bit different.

H(x)= fixed length code (hash code h)

Where "H" is the hash function,

"x" is the message,

"h" is the hash value or code(message digest).

There are three requirements for the practical application of Hash functions

Variable input size

Fixed Input size

Efficiency

Moving forward now, let's see what the security criteria in Hash functions are.

Security of Hash Functions

There are, in total, three ways by which the security of hash functions in cryptography is achieved. We will learn and understand all of them one by one and then compare them with each other to know how to use them better.

These three properties, Preimage resistance, Second preimage resistance, and Collision resistance, make a cryptographic hash function cryptographically strong.

Preimage Resistance

Hash functions provide preimage resistance. Preimage resistance is a one-way property that is difficult to turn; for any given hash value, it is computationally infeasible to find y such that H(y) = h.

Where y is the message input,

h is the hash code,

H is a hash function.

This property is important if the authentication technique involves the use of a secret value.

Second Preimage Resistance

Second preimage resistance is another security criteria in Hash that is impossible to find an alternative message with the same hash value as a given message.

For any given block, it is computationally infeasible to find y!=x with H(y) = H(x).

Where x and y are different message inputs,

H is a hash function.

The second preimage resistance works on the one-way principle of hash functions.

Collision Resistance

A strong hash function is one that also satisfies collision-resistant security criteria. A collision attack, in which one party creates a message for another party to sign, is prevented by a robust hash function.

It is computationally infeasible to find two messages, x and y, such that Hash(x) = Hash(y).

Where x and y are different message inputs,

H is a hash function.

And such a pair of messages, x and y, is called a cryptographic hash function. This means that it is practically impossible to create a hash value that indicates two different message inputs.

It leads to more security from attacks.

Comparison between the Security Criterias

The following table compares the three security requirements for hash functions: collision resistance, second preimage resistance, and preimage resistance.

Feature

Preimage resistance

Second preimage resistance

Collision resistance

Hash function

Weak

Weak

Strong

Requirements

It is the first property.

Before the second preimage resistance, the preimage resistance is needed.

Before collision resistance, the second preimage resistance is needed.

Length of Bits

Minimum 80 bits

Not less than 90 bits

160 bits

Checking of Hash Function

Computationally infeasible to find y such that H(y) = h.

Computationally infeasible to find y!=x with H(y) = H(x).

Computationally infeasible to find two messages, x and y, such that Hash(x) = Hash(y).

Function

It is practically impossible to obtain a message from a hash code.

It is practically impossible to obtain a different input message when we decode a hash value.

It is practically impossible to create a hash value that indicates two distinct message inputs.

Cryptography allows you to store sensitive information or send it through insecure networks (such as the Internet).

What are hash functions?

Hash Functions in cryptography generate a code to check the message's authenticity.

What are the security criteria in Hash?

Three security Criteria in Hash are preimage resistance, second preimage resistance, and collision resistance.

What is the encrypted data called in cryptography?

The encrypted data is called the CipherText. Only the person with access to the decryption key can decode and understand the plain text.

What is the Collision resistance security criteria in the Hash function?

It becomes a strong hash function if the collision-resistant security criteria is met. A collision attack, in which one party creates a message for another party to sign, is prevented by a strong hash function.

How do you know if a hash function is second preimage resistance?

A hash function is second preimage resistance if it is infeasible to find y!=x with H(y) = H(x).

Conclusion

Kudos, Ninjas; we are at the end of the article on Comparison of Security Criteria in Hash, where we discussed what cryptography is, what hash functions are, what are the security of hash functions and the comparison between them.

Keep going and read more articles based on cryptography and the security of hash functions.