Part of the CIA triad
when it comes to cyber security, is integrity.
So that means that we're going to have to make sure
that the information that we stored
is the same when we retrieve it,
because there's situations where
there's attacks happen, or there's just disruptions,
restarts, reboots that messes up data.
So sometimes we might think we're getting
what we originally set, but that's not actually the case.
So there's a way to check to make sure we have
the right integrity and that's through hashes.
And one of the most used hashes today,
is going to be the SHA-256 standard.
So we're going to use the SHA-256 sum command
and we're going to go through
and we're going to create hashes of a directory,
and then we're going to do a hash sum check
on the directory just to verify that it works,
make some changes, and see what happens
when it does not match.
So first thing we're going to do,
we're going to run this batch command.
SHA256sum on our SensitiveData folder,
I'm going to use it on every file,
put it into our hash.
All right, let's see if they went through there.
Okay, so we can see the hashes created.
Let's check out what that looks like.
All right.
We see we have two hashes of these files.
Next we're going to go through
and compare the hashes to the hashes of the current file.
sudo sha256sum check hashes.
All right, so we can see that it ran hash on the files
and then compared them to what the list was
that we created earlier, with the hashes that text
and the show that they match.
Now let's make some modifications
and we'll see what happened when we do that.
So that's going to make change to the files
and verify that they failed the integrity check.
sudo bash .c echo random data.
and then we're going to remove one of the files.
Okay, so now we're going to run the command on it.
Okay, so we see it lets us know that the list one fail
because that's the one we modified when we added
the new random information,
list three, we removed it, so it's not even present.
So it lets us know exactly what was wrong,
let us know that it didn't match,
and that's because it compared the hash values
that it runs instantly on the files,
to the ones in the text.
All right, that was just a quick example
and a quick walkthrough of how to use
the SHA-256 sum to create hashes
and to compare them for later views.
Thank you for sticking with this walkthrough
and I'll see you in the next lesson.