In the world of data security encryption is important.
But there's also a lot of times where I just want to verify that the data is good.
Like for example I've got this big pile of text.
It could be a Word document.
I don't care what it is.
But while I'm sending this to somebody else and as they receive it I want to make sure that everything
is exactly the same.
Now to do that we use something called a hash. A hash is an algorithm that doesn't encrypt,
but what it does instead is it takes a big string of data like this.
So we take it we throw it into the hash algorithm. Gotta turn the crank,
very important. And the end result is a string of text a binary value that is fixed in size.
What's important to appreciate about this is that I can take another completely different piece of text
and notice that this is a lot smaller.
I can run it through the algorithm and I will still get a fixed amount of text.
In this case it's 128 bits it's 32 hexadecimal values.
So no matter what I run through it it will always come out the same size.
Now the cool thing about a hash is that there's no way you can see this from your camera.
But if you take a look in here I'm going to pick one little letter like the letter A and I can change
the letter A to a letter E and I will get a completely different hash value.
So hashes are really good ways to be able to determine if anything has been changed.
I can take a massive video and change one bit in a massive 20 megabyte video file and just change one
bit and I will get a completely different hash value.
So hashes are a really great way to verify that the data hasn't been changed.
Now we use hashes all over the place in the computer world.
So what I want to do now is I'm going to fire up my computer and let's take a look at hash in action.
One of the most common places we'll see people using hashes is when you're downloading stuff.
So I'm downloading a copy of the Ubuntu Linux distribution.
And as I go through I'm trying to find my particular distribution and what I'm going to do is I'm going
to download an iso for my amd processor.
So here it is right here.
Now this is a huge 700 megabyte file.
So what I can do when I download it what these folks will do is they'll give me some examples of hashes.
There's two very common hashes that are used MD5 and SHA-1. SHA-2 is another one that's starting
to show up a little bit.
So what they'll do let's say we use MD5.
So these are actually the hash values for all of the different files that I can download.
And here's the amd iso I want to download right here.
So what I can do is I can download the file then I can run my own hash against that file and if my value
doesn't come up to match this I know there's been a problem with the download I get the wrong file or
something like that that makes me know that something's wrong.
Now you can run hashes all day long.
In fact there are programs that you can download to run your hashes but you can do them online as well.
So here I've got something called a hash generator there's hundreds of these.
So I can type in just any value I want in here.
And I can run hashes.
So when I run these hashes here all the different types of hashes so there's lots of different types
hashes you can use.
But the common ones are going to be here's MD5,
very common, here's SHA-1.
And between those two that's going to be the two most common SHA-2 is known as any of these other
values SHA-256, SHA-384 those are all generically known as SHA-2's.
So I can get a whole bunch of hashes generated so what I'm going to do now, you can see let's look at
that value.
In fact let's just worry about the last three letters B0B so what I'm going to do is I'm going to
change the lowercase i to uppercase
I. And I'm going to rerun the hash and you watch that well it's probably going to redo the screen, it didn't,
OK.
But you can see that the SHA values are completely changed.
And the MD5 value as well. All the hash tags are completely changed
even though I changed just one little tiny letter. So that my friends is a hash value. It's not an encryption.
It's not an authentication.
All it does is it's a way to confirm that whatever piece of data you have is exactly what you were expecting.