Introduction: – In your previous tutorials there were some security measure topics which come up with the term called hash functions. So, let’s learn and understand what hash function is and how it helps in security through this tutorial.
What is Hash Function?
Hash Function is one of the most widely used cryptographic technique and is implemented in various applications. These hash functions are basically a mathematical algorithms which are used for converting any numerical inputs to a different numerical values in compressed form. There are various classes of hash functions. The cryptographic has functions are a different kind of hash functions having special abilities to be used in cryptography. Internally it
uses mapping of arbitrary sized data to a fixed sized bit string, which is actually called the hash, and is designed in such a way that it becomes a one way function. One way means, the once hashing is done on certain data making it encode in specific form, it cannot be revert back or is not feasible to invert its action or becomes extremely hard to revert back to its initial form.
5 Major characteristics of Hash function: –
An ideal hashing function in cryptography has 5 major characteristics. These are –
- For any given information, computation becomes quicker
- A small change in the information changes the hash value that has previously generated
- It is not possible to generate any message from the hash value
- Generation of same message results in generation of same hash value which is deterministic
- Creation of two different message with same hash value is not feasible
What is message digest?
The values returned by your hash function are termed as message digest. They are designed in such an order that they can help in protection of data integrity and has the capability to detect any changes done in any part of data.
Collision Resistance: –
This is a special characteristic which makes it harder to find 2 different inputs of any length which concludes as a same hash. This characteristics is also referred to as collision free hash function. The mathematical expression for this hash function can be written something like this: h(x) = h(y). This characteristic confirms that the collision becomes hard to get. This feature resists an attacker making it difficult in finding 2 input values having identical hash.
Internal Structure of Hash function Algorithms: –
The mathematical function resides at the heart of hashing operating 2 fixed size blocks of data for creating a hash code. In this, each block varies depending on that mathematical algorithm. The block size ranges from 128 to 512 bits. Here is a simple demonstration of how it looks like –
The hashing function involves rounding of hash functions in the form of block cipher. Each round has a fixed size input and the rounding process repeats itself as long as the entire information or message is not hashed. In hashing the first message block value becomes the input process for second hashing round, and so on. This chain of output value as input effect is termed as avalanche hashing effect. This results in change in value with slight change in the
Some popular hashing algorithm examples are: –
- SHA (Secure Hash Function)