Are you familiar with the concept of QR codes? Now imagine why QR codes are so famous for encrypting information in the modern times. It’s because of their easy-to-scan but impossible to decipher otherwise nature. There’s no other way to know what information a QR code holds than scanning it.
Hash blocks are like those, but better! They’re extremely useful and appear in almost all information security platforms.
These Hash Blocks are made of Hash Functions. Hash function is a mathematical function that converts any value, of any length, into an alphanumeric code of a fixed length. So even if your input data spans the lengths of The Great Wall of China, your output data will only be as long as any other.?
These alphanumeric codes returned by a hash function are called message digest or simply hash values.
The typical features of hash functions are ?
- Fixed Length Output (Hash Value)
- Hash functions convert any length of data to a fixed length output, process of which is called hashing the data.
- Because of this nature of its output, hash functions are also called compression functions.
- And since hash output is a much smaller representation of a bigger input, it’s called a digest.
- Popular hash functions generate values between 160 to 512 bits.2 bits.
- Efficiency of Operation
- Generally for any hash function h with input x, computation of h(x) is a fast operation.
- Computationally hash functions are much faster than a symmetric encryption.
To prove as an effective cryptographic tool, a hash function is desired to possess the following properties ?
- Pre-Image Resistance
- This means that hash functions should be technically impossible to reverse back to its original input.
- In other words, if a hash function h produces a hash value z, then it should be a difficult process to find any input value x that hashes to z.
- This property protects against an attacker who only has a hash value and is trying to find the input.
- Second Pre-Image Resistance
- This property means that if there’s one input with a certain hash, it would be almost impossible to find a different input with the same hash.
- In other words, if a hash function h for an input x produces hash value h(x), then it should be difficult to find any other input value y such that h(y) = h(x).
- This characteristic of the hash function guards against an attacker who possesses an input value and its hash and wishes to replace the original input value with another value that is legitimate.
- Collision Resistance
- Due to this fact, it should be challenging to compare two inputs of differing lengths that produce the same hash. Another name for this characteristic is a collision-free hash function.
- In other words, it is challenging to discover any two distinct inputs x and y such that h(x) = h for a hash function h. (y).
- It is difficult for a hash function to be collision-free because it compresses data with a set hash length. These collisions should be difficult to locate, as this attribute of collision free simply serves to affirm.
- Due to this characteristic, it is highly challenging for an attacker to identify two input values that have the same hash.
- Additionally, a hash function is second pre-image resistant if it is collision-resistant.