Contact Form

Name

Email *

Message *

Mattia’s Dummies' Corner - What’s a hash value?

I've decided to start a new section of this blog, where I will explain the meaning of specific IT terms, be them common or not.

I'll try explaining them like I talked to a fifth grader.

Hope it'll be helpful and you guys will enjoy it.

Definition of hash value

We all know what a signature is. Most of us can sign their name.

A hash value is the equivalent of a signature for a file. Each file on a computer, analyzed at its deepest level, is but a sequence of bits.

In other words, it's a sequence of zeros and ones. Why's that?
Computers work with zeros and ones, not with our common language. Zeros and ones are turned into a more readable form for us to use the computer.

For example, when you print a document, its content is first turned into bits. Bits are sent to the printer (through the cable, or wirelessly) and the printer turns them into words, images, or whatever we wanted.

For each file, you can calculate a hash value by using a mathematical function called hash function.

This function returns a value, called hash, which is a signature for a file.

A hash is used to make sure a file hasn't been changed and it's not corrupt.

In fact, if you alter a file in any way, its hash value will change.

Why do we need hashes?

A hash value is used to understand if a file has been altered, corrupted, or changed.

Sometimes, when you download a program from a website, you'll see a hash value for that file, displayed in the download page (see example below).

After downloading the file you want, you can calculate its hash value, by using programs or web applications.

If the value you calculated is the same as the value shown in the website where you downloaded the file from, you're OK. 

You can safely install that program because you can trust that file.

If you get a different value, instead, you have a problem. Your file might have gotten corrupted while downloading it, may contain a virus, or it's not good anyway.

A hands-on example

The below figure shows the hash value calculated for the string "hello" and then re-calculated for the string "Hello".

Notice the two hash values are totally different, even though I changed the first letter only.

Any minimal change totally modifies the hash value, and it doesn't matter how small it is.

Even changing a bit alters it completely.

This feature allows you to visually and immediately discover if your files have been altered, or potentially corrupted.



For more information: Hash function

Comments

Related Posts Plugin for WordPress, Blogger...