As each person has its own signature, so do files.
For files, it’s called hash and it’s calculated based on the numbers of 0’s and 1’s that actually compose that file.
At the low level, each file is a bunch of zeros and ones, or bits.
Now, as a person can’t replicate exactly another person’s signature, so no two files have the same hash.
What’s more, when you change a file, its hash changes, too, because the bits contained in it change.
This is easier to understand if I show you this example:
You see that I have two strings (text) almost identical above.
I calculated the hash for the string “Hello”.
Now look what happens if I only change the first letter to lowercase (“hello”).
You see that I get two completely different values and I only changed a byte of the string (=8 bits. Each character in the string is 8 bits, aka 1 byte).
These features of a hash value allow you to make sure no changes were made to a file and it’s therefore safe.
Hope a 5-year old gets that :)
Top comments (0)