- Let's go over what are hashing algorithms.
And before we do that, let's see what is actually hashing.
So hashing is a method used to verify data integrity, right?
That means that you can verify the integrity of a file.
You can verify the integrity of
data being exchanged between two entities,
or you can verify the integrity
of a process or a program, right?
A cryptographic hash function is a process
that actually takes a block of data.
And then it creates a small fixed size hash values, right?
It's a one way function.
That means that actually
if two different computers take the same data
and run the same hash function
they should get the same fixed size hash value.
For example, you know, perhaps a 12 bit long hash
and I'll demo this in a few minutes.
Now, examples of hashing algorithms are
the Message digest 5 or MD5
which actually creates 128 bit digest.
And it's actually less secure
than the ones below the secure hash algorithm or SHA-1.
It actually creates 160 bit digest.
And then the more secure is the second version of that
which is a secure hash algorithm or SHA version two
which actually include digest between 224 bits and 512 bits.
So in this example, I actually have three files, right?
File one, file two, and file three.
And as a matter of fact, if you actually see, you know
file one in this case actually has the same bites.
That's five, three.
So it's 32 of the sites.
And as a matter of fact.
If we do a LS minus H to do a human oops LS minus L and H
you can see actually 32 bites
in each and then file two has 288 bites.
If we actually look at each of the files.
So let's look at file one, for example
the file context is, you know, is just self explanatory.
This is the contents of the file.
That's what is actually in that file.
If you look at file two, the contents of the file
this is actually this and you, if you see
there's actually more data subsequently
you see the number of bites actually increase.
Now, this is the particular fashioning here.
File three is name file three.
However, if I open that file,
you will see that the content
is exactly the same as file one.
As a matter of fact, what I did before is demo is
I actually copy file one to file three.
Now let's actually take a look at the actual hashing, right?
So how to verify the integrity of those files
and you can actually have most operating system
actually support a hashing verification.
In this case, I'm actually running on the Mac OSS device.
This is very similar to a Linux environment as well.
And there's a shasum utility, right?
That you can actually use.
And so matter of fact
I'm actually just gonna do the help in here.
And basically it prints or checks
the check sums of a file or, you know, a binary.
And in this case
I'm actually gonna use the 512 option of a SHA-2.
So let's do this real quick
shasum minus A for algorithm, and then 512
I'm gonna do it through all the files in these directories.
So doing a wild card
and here you actually see the different hashes
for each of the files.
So if you look at, remember that the contents
of file one and file three were the same.
You actually see that the shasum calculated
or the hash sum calculated that is actually done in here.
And hexadecimal code in here
is exactly the same as file three, right?
So again, file two was actually different
and subsequently you actually see it as a different
a different output here.
So this is actually very important to know
especially whenever you're actually doing file integrity
and file verification and, you know,
any other type of verification using hashing algorithms.
And here, actually, I want to summarize
what you learned in the, in this lesson
and in the previous lesson, right?
So encryption algorithms and hashing algorithms
and what they're actually used for, right.
So first starting from the left
and the top left symmetrical encryption algorithms
remember that they actually use the same key
for encrypting and decrypting data.
And these are some of the examples of those algorithms.
Then you have asymmetrical encryption algorithms
which use a public or private key, right?
So one key to encrypt data and another one actually used
to decrypt and some examples of those algorithms.
Then we actually cover as well, digital signatures, right?
So this is actually done for the encryption
of a hash using a private key, and then the decryption
of a hash using the senders public key.
As we actually saw in the previous examples of PGP, right?
Also you have the Diffie-Helman Key Exchange.
And you know, of course the examples using IP sec
and encryption algorithms and hashing algorithms using
use for confidentiality, integrity
and authentication, right?
So here, you know, self explanatory,
some encryption algorithms that provide
converting clear text to cipher texts,
increase the ability for you to actually
protect the confidentiality of you know,
transactions and files.
And these are some of the examples
of the encryption algorithms to do that.
And then for data integrity or for file integrity
which validates the data by compared hash values
just like we saw in the demo
these are the algorithms that actually are supported.
And then of course you actually have algorithms
for authentication and to verify the peers identity.