Hashing is one way, it’s irreversible (you cannot “de-hash” a hash to get back the original text).
As opposed to encrypting which is revisable (by decrypting).
A hash function is any function that can be used to map data of arbitrary size to data of fixed size.
The values returned by a hash function are called hash values, hash codes, digests, or simply hashes.
i.e: Hash functions compress large amounts of data into a small message digest.
Hash algorithms have a few requirements:
- One way (document -> hash). You can’t easily reverse a hash into the original document.
Speed. Churn into a big file for a second or at most. But not too quick b/c otherwise easy to break!
Avalanche effect: If when an input is changed slightly (for example, flipping a single bit) the output changes significantly (e.g., half the output bits flip).
Avoid hash collisions.
You’ll find that hashes play a role in:
- Browser security (website’s certificate – signing TSL certificate)
Managing code repositories (GIT strongly relies on hashes to identify commits and objects)
Detecting duplicate files in storage.
Over time, however, these requirements can fail due to attacks on the mathematical underpinnings of hash functions or to increases in computational power.
MD5 source code: https://tls.mbed.org/md5-source-code