>> Hash encryption is important because it basically allows you to determine whether
information has been changed, helps you determine the integrity of information. When you
create a hash of a file, you're not basically creating something, you're not encrypting it in
order to decrypt it, you're doing it a one time function.
Let me show you here. There are various different forms of algorithms out there, there's
MD5, there's SHA. In this case I'm gonna use SHA. And there are various different levels of
SHA that you can use. There's 256 bit, there's 512, there's all those. I'm gonna do a 256 hash
of a particular file.
In this case is the file called sensitive, it's a file I created. Now notice what just happened.
You're taking a look here at a particular resulting hash, and I'm highlighting it here. And it's
basically saying that hash is of sensitive.txt. Now, hashes are extremely closely related to the
contents of whatever they read.
In other words, if you make any change to a particular file, the resulting hash will change. So
let me show you real quick, I'll use my little Pico editor here and edit this file so it says this
is secret information. So I'm gonna add my name to it, James Stanger, there we go.
And I'm gonna save that information, now I'm gonna run the same command against it. Now
notice what's just happened here. So here's the old one, right? The old hash there, I just semi
highlighted. Look what's happened that hash is completely changed. Hash encryption is very
important part of the kind of Holy Trinity of encryption.
So you have hash encryption, symmetric key encryption, asymmetric key encryption and we
use these three things together to create SSL TLS. We use these things together to create
various types of solutions. And so what you can do is practical use of it, for example, is I've
downloaded a particular file.
This is an ISO file for Ubuntu version 20, the desktop. Now I've downloaded this and I
wanna see if I have a valid download. Downstream security is a big deal, in other words, if
you download an ISO file that has been altered by a hacker in one way or the other, you've
got problems.
So all of the software distributors have figured out a way to basically make it sure that you
have properly downloaded the file and that nobody has tampered with it. So for example,
I'm up here on the Ubuntu website and they're saying this particular ISO file, the one that I
downloaded, should have this particular SHA 256 value.
There it is, okay, so if we go here, I'll just copy and paste it here real quick, copy it. And then
I'm gonna go back to my little Linux system here and I'm gonna run SHA 256 against that
particular file. Let's see what we got here, all right?
There's the resulting hash code I'm gonna compare it real quick, just gonna eyeball it. What I
just pasted in here is the one directly from the website, this one that I'm highlighting here, is
that the hash result of that file. You notice they ain't the same, they aren't the same.
So in this case I know that for some reason there's something suspicious about this ISO file
and I shouldn't use it. So that's just one simple example of how hash encryption is used to
determine the integrity of a file. When it comes to additional practical uses of hashing code,
for example, you could take a look at how blockchain works.
In this case, each time there's a transaction that occurs, there is a hash that is generated for
the public for everyone to see. Assuming that they have done their hash code creation
properly, then that is something that is indelible. And it is something that is if it's recorded
properly publicly, you know that a certain transaction has truly occurred.
So in this case I can just type in additional data and I can say James Stangers birthday and
there is a hash there. And you can see that this hash gets generated and there's the previous
hash there, there's the existing hash. I have basically from this information created anew
hash with block chain, those hashes are added time and time again.
And with this, you basically have the ability to understand the integrity of information. You
can verify and you can actually make an assertion that a contract has happened or some sort
of network traffic has been generated and you can verify that. So there's just a couple of
ways in which hash encryption is used.