Hashing Functions

A blog about hashing functions

Hashing

A cryptographic hash function is a mathematical algorithm that maps data of arbitrary size (message) to a bit array of fixed size (message digest or hash). It has no private keys here and is deterministic and random (pseudo-random). Furthermore all operations are public such as the h(x) hash-function.

images about Hashing

Properties of Hashing

images about Hashing
  1. Deterministic : it mean that if we apply to same hash-function (SHA256) on the exact same input then the output must be the same.
  2. One-Way : it's easy to generate the hash with the given hashing algorithm but on the other hand it is extremely hard (time-consuming) to restore the original input, it's like a trap-door function.
  3. Collision-Free : There are no collisions in SHA256 (although there are but with extremely low probability), it means that no two different inputs share the same output hash and this is perfect because we want to make these hashes unique, this is how we identify a block in the blockchain.
  4. Avalanche Effect : A little change in the input results in a completely different output hash, otherwise a cryptanalyst can make predictions about the input based on the output exclusively.

MD5 Hashing Algorithm

MD5 runs entire files through a mathematical hashing algorithm to generate a signature that can be matched with an original file. That way, a received file can be authenticated as matching the original file that was sent, ensuring that the right files get where they need to go.

The MD5 hashing algorithm converts data into a string of 32 characters. For example, the word "This is an example" always generates this hash : 68791e1b03badd5e4eb9287660f67745 Similarly, a file of 1.5 GB also generates a hash with the same number of characters. When you send that file to someone, their computer authenticates its hash to ensure it matches the one you sent.

If you change just one bit in a file, no matter how large the file is, the hash output will be completely and irreversibly changed. Nothing less than an exact copy will pass the MD5 test.

images slide

Applications of Hashing

images about Hashing images about Hashing images about Hashing