What is hash?

β€’2 min read

In layman terms:

  • Hash: Compression of original substance that can be easily consumed. Also known as digest.
  • Digest: A summary of information.

A big file is processed and compressed into a small string; this is called the process of hashing.

"What is a 512-bit hash algorithm?"

The size of the final hash is 512-bit.

  • A 2MB file's hash value will be 512-bit long.
  • Even if the file size is 10MB, the final hash would be 512-bit long.

Same goes for SHA-512, SHA-256, etc. SHA is the algorithm name and the number represents the size of the hash value.

"What is the use of Hashing?"

-> Integrity check

Each file has a unique hash value for a given hashing technique (let's say SHA512).

If you copy a file from one place to another, a lot of times we end up comparing the hash of the original and copied file using md5sum (another hash algorithm with 128-bit size).

Comparing to make sure that both files are same, even a 1-bit change in the file will change the final hash and it won't match the original hash.

This is nothing but checking the Integrity of the file, that it hasn't been tampered with while copying.

Enjoyed this article?

Subscribe to get the latest deep dives on Linux and Security delivered to your inbox.

Subscribe to Newsletter

Get the latest articles on Linux, cryptography, and security delivered to your inbox.

No spam, unsubscribe anytime.

Comments Coming Soon

We are building a privacy-focused, secure commenting system. Stay tuned!