Hashes are powerful powerful tools in fact they're so powerful that they're used in very very unique
place known as a hash based Message Authentication Code that are known as an H mag.
Now to understand why an H Mac exists let's consider a scenario.
I've got two computers.
Now these computers have already gone through an encryption process and they're doing symmetric encryption
back and forth so they're sharing the same key.
The problem we have is that it is potentially possible that a bad guy could get in the middle of this
and mess up our communication in essence if we got Alice Allison Bob sending data back and forth they
have the same key because they've gone through some authentication process.
How do we know that they're still the same people they claim to be.
And that's where Macs come into play.
The idea of an H Mac is to take one individual packet and then add some information to the end of that
packet.
Now hashing is a trivial thing and if we were to take that one packet and hash it when it gets to the
other person of course they would be able to say How ever that message was when it left that we got
it in the same way by comparing hashes but an H Mac does something a little bit different.
What an H.M.S. going to do is generate a hash but not just a hash of that message whatever's in there
but it will actually use the key.
So if Alice wants to generate an H-back what she'll do is she'll take that packet.
She'll then go ahead and incorporate the key and then generate a hash.
Now there's a big difference here in terms of just taking a message adding the key to the end and making
a hash like that may actually use a much more complicated bit of math to make all this happen.
And they have to because if they simply took the hash and added the key that guys could crack that over
time so H-back is complicated but powerful and also very very quick and it is a great way to have more
confidence that that packet is coming from that person because the only way you're going to be able
to run the hash is that if you also have that key.
So that is a great aspect of H-back.
In fact I've got some H-back that we can actually do online.
Let me show you an example right here.
So to give you an example this is a wonderful little website called Free formatted dot com.
Thanks guys for letting me be part of this.
Anyway this is their Mac generator slash tester tool so what we can do here is we can type in some value
whatever we want to type in here.
This could be whatever is in our particular message but now we need to add some kind of secret key because
Macs don't work by themselves.
So we'll type in some kind of secret key and then we can generate a hash based on Mac protocols from
a whole bunch of different ways to do this.
So we're going to stick with something pretty common let's just do it old school empty five and can
compute this and you can see that I have now generated an H Mac Value based on that message and that
key.
So that's really the power of Mac more than anything else.
If I use Macs I have some way to be able to say the only way that I could get this message in the form
that it is is if somebody else has my key.
It's not a perfect tool but it gets us a lot closer to good security.