Skip to main content

Hashing

Hashing is the process of converting data to a fixed size output called hash. Any small change in the input data results in a completely different hash.

One-way Only

Hashing is a one-way process. We can't get the original data back from the hash.

Mathematical Algorithm

It uses a pure math algorithm on the data to build the hash.

Use cases​

  1. Digital signatures.
  2. Storing passwords.
  3. Verifying data integrity.
  4. Data shortening - For example, URL shortening.

SHA - Secure Hash Algorithm​

SHA256 algorithm produces a 256-bit hash of the original data. The output contains 256-bit array.

Every 4 bit is represented by a hexadecimal character. Therefore, the data what we see at the end is 64 characters.

HMAC - Hash-based Message Authentication Code​

HMAC is a specific type of hashing algorithm that uses a secret key along with the data to produce a hash. This ensures that only the parties with the secret key can verify the integrity of the data.

Used for Authentication

Since HMAC uses a secret key, it works for user auth too.