WEBVTT

00:01.010 --> 00:09.370
Of any episode that I do in this entire series this is my favorite because this my friends is cryptography.

00:09.440 --> 00:17.600
Cryptography is the science the study of taking data and making it hidden in some way so that other

00:17.600 --> 00:19.360
people can't see it.

00:19.460 --> 00:21.270
And then bringing the data back.

00:21.320 --> 00:27.200
So the big word we want to use when we talk about cryptography is taking some kind of information and

00:27.200 --> 00:30.130
providing confidentiality to that.

00:30.140 --> 00:35.600
Now we do this through a number of different ways but the magic word I want to use right now is obvious

00:35.600 --> 00:43.400
occasion obvious occasion is to take something that looks like it makes sense and to hide it so that

00:43.400 --> 00:47.260
it does not make sense to the casual outside observer.

00:47.630 --> 00:53.210
Now theres a lot of different ways we can do obfuscation to provide confidentiality What are the things

00:53.210 --> 00:54.710
we can do is diffusion.

00:54.710 --> 00:57.740
So here is a picture of my grandson right here.

00:57.740 --> 01:00.320
Let's take a look at that that Steve and then the gorgeous.

01:00.320 --> 01:05.870
So what I'm going to do is I'm going to diffuse this image and make it fuzzier.

01:05.870 --> 01:10.460
Now in this particular case we didn't diffuse it too much so if you look at it you could probably tell

01:10.460 --> 01:13.560
there's still a cute little kid there and he is cute.

01:13.940 --> 01:22.220
But diffusion only allows us to make it less visible less obvious.

01:22.250 --> 01:27.290
Now what we can also do is confusion so let's take that same image of Steve one more time just stir

01:27.290 --> 01:27.550
it up.

01:27.560 --> 01:29.340
Let's just make a mess out of it.

01:29.660 --> 01:34.370
Now in this particular case we've created a lot of confusion of the image and it basically stirred up

01:34.760 --> 01:40.400
and it would be very difficult for somebody to simply look at this and go oh that must be Mike's grandson

01:40.400 --> 01:41.220
Stephen.

01:41.240 --> 01:46.670
So the other challenge we have with cryptography is we go through this process of taking some kind of

01:46.670 --> 01:50.100
data and we go through this obfuscation process.

01:50.240 --> 01:57.350
But and here's the important one is that we've then got to take this obfuscated data and some way bring

01:57.350 --> 01:59.880
it back into its original form.

01:59.960 --> 02:06.910
So we call this encryption and decryption and cryptography is the process of making this happen.

02:06.920 --> 02:09.530
Cryptography has been around for a long long time.

02:09.800 --> 02:16.040
In fact probably one of the oldest type of cryptography has ever been around is something called the

02:16.050 --> 02:20.040
Sezer cipher.

02:20.120 --> 02:25.130
I don't know about you but when I was a little kid and I was eating a box of cereal you dump out the

02:25.130 --> 02:28.600
box of cereal and you'd get some kind of prize inside.

02:28.600 --> 02:31.250
And one of the things we'd get is called a secret decoder ring.

02:31.280 --> 02:32.290
So what I want to do here.

02:32.290 --> 02:34.680
Let's can we put up a picture of a secret decoder ring real Correct.

02:34.700 --> 02:34.990
OK.

02:35.000 --> 02:38.210
So this is a classic old school kids decoder ring.

02:38.210 --> 02:42.620
Now what I want to do is I've made my own decoder ring right here.

02:42.800 --> 02:45.330
And I'd like us to take a little peek at this guy.

02:45.740 --> 02:49.880
And what you're going to see here is I basically got a wheel with all the letters of the alphabet A

02:49.880 --> 02:51.890
through Z and on the inside.

02:51.920 --> 02:54.250
I've got letters the alphabet aither Z.

02:54.290 --> 03:00.580
So right now I've got them lined up eight a b to b c to see now what I can do to make a secret code.

03:00.740 --> 03:04.450
Let's say I can turn this to I can rotate this two times.

03:04.650 --> 03:11.810
And what we can do is we can take our original plane information what we call the plain text message

03:12.230 --> 03:13.470
that we want to encrypt.

03:13.670 --> 03:18.220
And we just change the letters so we call this substitution.

03:18.230 --> 03:21.530
What we'll do is we'll take one value and substitute for another.

03:21.530 --> 03:23.920
Now in this case I've rotated it twice.

03:24.020 --> 03:27.730
So we actually have a term for this we call it r o t to.

03:27.770 --> 03:28.810
Just like that.

03:29.120 --> 03:32.710
And if I turned it three times it would be Arati 3.

03:32.750 --> 03:38.360
Now so we can take like the word ace A C E.

03:38.750 --> 03:44.560
And I can change a c e to see.

03:46.140 --> 03:47.740
G get the idea.

03:47.850 --> 03:51.620
So that's the cornerstone of the Sezer cipher.

03:51.790 --> 03:58.200
So to convert something with a Caesar cipher and perfect that just go through the process real quick.

03:58.200 --> 04:03.550
Now what I'm going to do let's put up a piece of plain text that we want to encrypt.

04:03.600 --> 04:05.210
We attack at dawn.

04:05.220 --> 04:06.900
So here it is we attack at dawn now.

04:06.960 --> 04:09.610
First we are going to do get rid of all the spaces.

04:09.630 --> 04:12.240
So now it just says we attack at dawn very readable.

04:12.270 --> 04:15.750
We don't worry about upper or lower case in this particular situation.

04:15.760 --> 04:23.320
Now let's go ahead and put our groovy little secret decoder ring up there and let's go ahead and turn

04:23.320 --> 04:26.380
it in this particular case five times.

04:26.380 --> 04:26.960
All right.

04:27.040 --> 04:28.970
So we're doing an OT 5.

04:28.970 --> 04:34.050
So let's turn it one two three four five times.

04:34.070 --> 04:39.910
So now what we can do is by using the secret decoder ring we can go ahead and encrypt.

04:39.970 --> 04:42.330
We attack at dawn as follows.

04:43.340 --> 04:47.600
So what we now have generated is a classic Caesar cipher.

04:47.720 --> 04:51.380
Now there's a problem with Sezer ciphers and the biggest problem we have with the more Anything else

04:51.410 --> 04:57.920
is that in fact people who like crossword puzzle books will pay money to be able to do this is that

04:58.100 --> 05:00.870
we can decrypt them.

05:00.920 --> 05:06.020
We can just by looking at them we can provide what's known as cryptanalysis.

05:06.020 --> 05:10.370
Cryptanalysis is breaking these encrypted codes.

05:10.550 --> 05:17.850
So the problem is is that anybody who's good at these things could pretty easily crack this so the Caesar

05:17.870 --> 05:23.570
cipher even though it is a substitution cypher does have the problem is that it's just too easy to predict

05:24.020 --> 05:26.600
what this is because we're used to looking at words.

05:26.870 --> 05:29.870
So what I want to do is make it a little bit more challenging.

05:29.870 --> 05:35.660
The first thing I'd like to try to do is I want to bring in something called the V-J cipher

05:38.400 --> 05:44.400
the cornerstone of vision a cipher is that it's really just a Caesar cipher with a little bit of extra

05:44.790 --> 05:46.170
confusion involved.

05:46.170 --> 05:52.800
So what I've got here is a table that shows all the possible Sezer ciphers there are.

05:52.800 --> 05:56.010
So here at the top we're going to have the word plain text I'll show you how that works.

05:56.020 --> 06:02.220
Just a minute and then you'll see on the far left hand side it says 0 through 25.

06:02.220 --> 06:08.670
So these are all the possible Arati values you can have from our zero which means a equals a big will

06:08.730 --> 06:12.480
be all the way down to our OT 25.

06:12.480 --> 06:16.980
So what we're going to do let's hold onto this for a minute and now let's go ahead and start with a

06:16.980 --> 06:21.210
piece of plaintexts let's use we attack at dawn one more time.

06:21.420 --> 06:25.250
And what I'm going to do this time is we're going to apply a key.

06:25.290 --> 06:28.560
The key is simply a word that's going to help us do this encryption.

06:28.650 --> 06:34.150
In this particular case I'm going to use the word face f a c e.

06:34.590 --> 06:42.330
Now what I'm going to do is I'm going to put F A C above the first four letters of we attack at dawn.

06:42.330 --> 06:47.810
So here we go F A C and then I'm going to just keep repeating that so it put face again.

06:48.030 --> 06:51.240
I'm going to put a face again and you'll see I've got two letters left over.

06:51.240 --> 06:51.830
No big deal.

06:51.830 --> 06:53.280
I just put a.

06:53.550 --> 06:57.930
And what we've done is we have applied a key to our plain text.

06:57.930 --> 07:05.760
Now what we're going to do is we're going to use the key to change the Caesar cipher OT value for every

07:05.760 --> 07:06.920
single letter.

07:06.930 --> 07:08.730
So let's go ahead and do this.

07:08.820 --> 07:11.190
Now what I'm going to do is I'm going to reference my little chart here.

07:11.190 --> 07:15.550
So the first letter of the plaintext is the W in we.

07:15.600 --> 07:18.150
So here's the W up at the top.

07:19.250 --> 07:23.100
And the key value is f..

07:23.130 --> 07:27.250
So let's go down on the y axis here till we get to an F..

07:27.330 --> 07:29.610
They see that f you'll see the number five right next to it.

07:29.610 --> 07:31.580
So this is Aro T5.

07:31.590 --> 07:38.620
So all I need to do is do the intersection of these and we get the letter B Great let's do it again.

07:38.650 --> 07:42.100
Now in this case the second time it's the letter E from we.

07:42.400 --> 07:48.520
And in this particular case the key value is a which is kind of interesting because that's our goatees

07:48.880 --> 07:49.360
zero.

07:49.360 --> 07:50.690
But that still works.

07:50.710 --> 07:53.000
So we start up at the top find the letter e.

07:53.440 --> 07:54.530
Then we find that a.

07:54.580 --> 07:56.790
And in this case because it's our OT 0.

07:56.830 --> 08:01.320
By coincidence e is going to stay as e.

08:01.450 --> 08:04.990
Let's do the third value now this time it's the A's in attack.

08:05.110 --> 08:10.330
So we go up the top there's the letter A and the key value is C is Charlie.

08:10.360 --> 08:11.860
So we go down to the C.

08:11.950 --> 08:19.150
That's our T2 and we then see that the letter A is now going to b c.

08:19.310 --> 08:21.080
Ok let's do one more real quick.

08:21.190 --> 08:24.600
In this particular case it's the first T and attack.

08:24.700 --> 08:31.200
So we come over to the T's and now the key value is e is in is in phase so we go down here.

08:31.210 --> 08:34.120
That's our code for we do the intersection.

08:34.120 --> 08:36.500
And now we've got an X..

08:36.520 --> 08:42.460
So the first four letters of our encrypted code is B E C X..

08:42.460 --> 08:45.600
So let's go ahead and run through and do the rest of these real quick.

08:45.610 --> 08:52.690
Just put those in for you and we have now encrypted in the vision a style.

08:52.730 --> 09:00.080
So the beauty of the day is that it actually gives us all the pieces we need to create a classic piece

09:00.080 --> 09:01.310
of cryptography.

09:01.310 --> 09:07.790
Number one we have an algorithm and the algorithm are the different types of Sezer ciphers and the rotations.

09:07.790 --> 09:15.700
And second we have a key and the key allows us to make any type of changes we want within our O.T. 0

09:15.710 --> 09:19.930
to our code 25 to be able to encrypt our values.

09:20.240 --> 09:25.070
Any algorithm out there is going to use a key in today's world.

09:25.070 --> 09:29.870
So when we're talking about cryptography today we're always going to be talking about algorithms and

09:29.870 --> 09:30.830
keys.

09:30.830 --> 09:36.180
Now the problem with the vision day is that well number one it's surprisingly crackable Isn't that interesting.

09:36.260 --> 09:41.240
But the bigger problem is his vision a works just great for letters of the alphabet.

09:41.480 --> 09:52.220
Unfortunately it's terrible for encrypting pictures or sequel databases or your credit card information

09:52.700 --> 09:53.920
in the computer world.

09:53.930 --> 09:57.660
Everything is binary everything is ones and zeros.

09:57.680 --> 10:05.480
So what we need to do is come up with algorithms that provide the type of encryptions and descriptions

10:05.480 --> 10:10.550
we need to encrypt and decrypt long strings of just ones and zeros.

10:10.550 --> 10:13.970
Now if you look at a string of ones and zeros you go hot.

10:14.000 --> 10:17.210
How does anybody make anything out of this will they do that.

10:17.230 --> 10:21.920
There's a you've got a string of ones and zeros may look like nothing Utu a human being but to Microsoft

10:22.100 --> 10:28.310
Word that could be a word document or it could be a voice over IP conversation or it could be a database

10:28.310 --> 10:29.500
stored on a hard drive.

10:29.540 --> 10:30.340
I don't know.

10:30.350 --> 10:35.210
But just because as human beings we look at long strings of ones and zeros and get confused.

10:35.210 --> 10:37.680
Trust me the computers don't.

10:37.840 --> 10:43.450
What we need to do though is we need to come up with algorithms which unlike Caesar's or vision visionaries

10:44.050 --> 10:46.270
that will work with binary data.

10:46.300 --> 10:50.100
Now luckily for us there are a lot of different ways to do this.

10:50.110 --> 10:57.550
So what we're going to do is I'm got an example of a algorithm we're going to use that encrypts a simple

10:57.550 --> 11:03.040
phrase that we're going to we're going to convert those to binary by the way and we're going to do this

11:03.400 --> 11:10.870
using a very interesting type of binary calculation called exclusive or for our first encryption.

11:10.870 --> 11:12.960
I'm going to encrypt my name.

11:13.000 --> 11:16.260
So here's my name Mike and I K E.

11:16.450 --> 11:21.550
Now the first thing we have to do is we're going to have to convert this to the binary that a computer

11:21.550 --> 11:22.370
would use.

11:22.390 --> 11:28.060
So I'm going to be using the binary equivalence of these text values.

11:28.180 --> 11:31.600
So let me go ahead and convert these into their binary equivalents.

11:31.930 --> 11:37.750
And anybody who's ever looked at ASCII code or Unicode should be aware that we can convert these into

11:37.750 --> 11:38.190
binary.

11:38.230 --> 11:39.370
OK so here we go.

11:39.370 --> 11:42.630
So there's n i k e.

11:42.850 --> 11:44.730
Converted into binary.

11:44.740 --> 11:53.110
Now notice that each character takes eight binary digits so we got 32 bits of data that we need to encrypt

11:53.110 --> 11:54.670
So that's our clear text.

11:54.670 --> 11:59.650
Now in order to do this we're going to need two things First of all we're gonna need an algorithm and

11:59.650 --> 12:01.270
then we're going to need a key.

12:01.270 --> 12:06.250
Now keep in mind what I'm making up is like the simple version of encryption you can possibly do.

12:06.250 --> 12:06.840
So let's go ahead.

12:06.850 --> 12:09.040
First of all set up our algorithm.

12:09.040 --> 12:14.620
Now our algorithm is extremely simple using what we call an exclusive or so.

12:15.340 --> 12:18.220
Here's the exclusive or this is what we call a truth table.

12:18.220 --> 12:23.680
So what I'm going to do is I'm going to choose because this Mike algorithm arbitrarily chooses this

12:24.010 --> 12:27.870
is I'm going to be using a five bit key.

12:27.880 --> 12:32.090
Now there's a reason I'm using a tiny tiny shortcut like this in the real world.

12:32.110 --> 12:37.180
Keys can be thousands of bytes long but for right now we're just going to use a five bit key.

12:37.180 --> 12:40.390
So to make this work let's start placing the key.

12:40.390 --> 12:42.970
So I'm going to put the key over the first five bits.

12:42.970 --> 12:49.420
So here at the letter M for Mike and now we can look at this table and we can start doing the conversion.

12:49.420 --> 12:57.220
So let's convert those first two values then the next then the next then the next.

12:57.220 --> 12:59.550
OK so now we've converted a whole piece worth.

12:59.560 --> 13:04.850
But in order to keep going all we have to do is shlepped that key right back up there OK.

13:04.870 --> 13:08.120
In fact let's go ahead and extend the key all the way out.

13:08.470 --> 13:14.290
So now the key Do we just keep repeating it and you'll see here at the end it doesn't quite line up.

13:14.380 --> 13:15.400
No problem.

13:15.400 --> 13:20.060
Just add whatever amount of key you need to go ahead and fill up the rest of this.

13:20.060 --> 13:22.140
So there we go.

13:22.390 --> 13:25.160
OK so now we can go ahead and complete this.

13:25.180 --> 13:26.810
Now let's just do it fast.

13:26.810 --> 13:33.050
You can double check me if you want but as we go through here using the exclusive or algorithm we then

13:33.050 --> 13:39.920
create our ciphertext go and spot check a couple of those for me and make sure I got them right.

13:40.930 --> 13:41.490
OK.

13:41.600 --> 13:42.580
Beautiful.

13:42.680 --> 13:45.830
Now so this is the cipher text.

13:45.830 --> 13:48.500
Notice that we have an algorithm which is extremely simplistic.

13:48.500 --> 13:50.800
We have a key which is very very simple and short.

13:50.990 --> 13:58.090
But we now have an absolutely perfect example of binary encryption.

13:58.160 --> 14:02.720
Now to decrypt this we'd simply reverse the process so I'm not going to go through all that but appreciate

14:02.990 --> 14:09.020
that we would take the ciphertext play the place to keep to it and then basically run the algorithm

14:09.020 --> 14:14.780
backwards and then we would have the decrypted data.

14:14.790 --> 14:20.970
So even though we've only seen three types of encryption so far keep in mind that these really do everything

14:20.970 --> 14:23.700
that we're going to be seeing in later episodes.

14:23.730 --> 14:25.840
Just a lot more complicated now.

14:25.890 --> 14:27.420
A couple of things we need to think about here.

14:27.420 --> 14:33.180
First of all what's interesting is that if we always have an algorithm and a key there is a gentleman

14:33.270 --> 14:40.230
named August Kirchoff who came up with a very very interesting concept Kirchhoff's principle says this

14:41.160 --> 14:45.540
As long as you don't know what the key is to an encryption.

14:45.660 --> 14:48.750
You can actually understand the algorithm completely.

14:48.750 --> 14:50.990
Now this is really really important.

14:51.030 --> 14:58.050
Today's big super duper encryption tools that we use out there to protect you on the internet are all

14:58.110 --> 14:59.200
open standards.

14:59.220 --> 15:02.270
Everybody knows how the algorithms work.

15:02.280 --> 15:03.350
Now you would think wait a minute.

15:03.360 --> 15:08.190
Now if I know how the lock works in essence wouldn't I be able to pick it easier.

15:08.220 --> 15:11.710
And the answer is interestingly enough no.

15:11.760 --> 15:19.400
In our society by showing everybody the walk everybody can check the lock to make sure it isn't pickle.

15:19.410 --> 15:25.740
So when we talk about proprietary encryption everybody gets nervous because if we don't all know how

15:25.740 --> 15:29.290
the lock works we can't all test the lock to make it work.

15:29.310 --> 15:35.580
So Kirchhoff's principle and something we stand to today simply says everybody knows the algorithm.

15:35.580 --> 15:38.620
But if you don't know the key it's not going to do you any good.

15:39.530 --> 15:44.870
So last thing I want to talk about in cryptography basics is the idea of what data are we encrypting.

15:44.870 --> 15:48.230
Because in the world data is all over the place.

15:48.530 --> 15:54.350
The first place we might think about is what we call data at rest now data at rest simply means something

15:54.350 --> 15:59.380
stored on a hard drive or on optical media or on a thumb drive or whatever it might be.

15:59.630 --> 16:05.540
And in these types of cases we encrypt the data when we put it onto the drive itself so it sits on the

16:05.540 --> 16:08.520
stored media in encrypted format.

16:08.570 --> 16:11.180
The other one is called data in transit.

16:11.180 --> 16:19.610
So if I've got a voice over IP call or I'm sending a text message that data is moving it's going through

16:19.610 --> 16:22.130
the internets and all the different tubes.

16:22.130 --> 16:26.760
And is that data to be encrypted while the data is in transit or not.

16:26.780 --> 16:27.960
This is a big issue.

16:28.400 --> 16:31.160
And the last one is data in process.

16:31.250 --> 16:36.950
So we take a big database and we pull it off of a hard drive when we start calculating on that database.

16:36.950 --> 16:40.210
So it's sitting in RAM or its citizens CPQ.

16:40.370 --> 16:46.250
Those are important areas for us to consider when we're talking about cryptography.

16:46.250 --> 16:57.610
Where are we going to be encrypting and decrypting that data.

17:01.540 --> 17:07.930
In.
