Hashing
Hashing is a process of converting data to any fixed size output called hash or digest. Any small change in the input data results in a completely different output hash.
One-way Only
Hashing is a one-way process. We can't get the original data back from the hash.
Use cases
- Digital signatures.
- Storing passwords.
- Verifying data integrity.
- Data shortening - Eg., URL shortening.
HMAC - Hash-based Message Authentication Code
HMAC is a specific type of hash that uses a secret key along with the data to produce a hash. This ensures that only parties with the secret key can verify the integrity of the data.
Used for Authentication
Since the HMAC involves a secret key, it's used for authentication purposes.