Cryptography Basics

17 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€91.73
List Price:  €128.43
You save:  €36.69
£78.50
List Price:  £109.90
You save:  £31.40
CA$135.42
List Price:  CA$189.60
You save:  CA$54.17
A$152.22
List Price:  A$213.12
You save:  A$60.89
S$133.77
List Price:  S$187.28
You save:  S$53.51
HK$781.89
List Price:  HK$1,094.68
You save:  HK$312.79
CHF 88.30
List Price:  CHF 123.63
You save:  CHF 35.32
NOK kr1,058
List Price:  NOK kr1,481.24
You save:  NOK kr423.24
DKK kr684.10
List Price:  DKK kr957.77
You save:  DKK kr273.66
NZ$164.15
List Price:  NZ$229.81
You save:  NZ$65.66
د.إ367.20
List Price:  د.إ514.09
You save:  د.إ146.89
৳10,978.23
List Price:  ৳15,369.96
You save:  ৳4,391.73
₹8,290.53
List Price:  ₹11,607.08
You save:  ₹3,316.54
RM471.80
List Price:  RM660.54
You save:  RM188.74
₦156,534.34
List Price:  ₦219,154.34
You save:  ₦62,620
₨27,950.66
List Price:  ₨39,132.05
You save:  ₨11,181.38
฿3,595.26
List Price:  ฿5,033.51
You save:  ฿1,438.25
₺3,229.78
List Price:  ₺4,521.83
You save:  ₺1,292.04
B$499.40
List Price:  B$699.18
You save:  B$199.78
R1,883.20
List Price:  R2,636.56
You save:  R753.35
Лв179.42
List Price:  Лв251.19
You save:  Лв71.77
₩133,286.20
List Price:  ₩186,606.01
You save:  ₩53,319.81
₪365.03
List Price:  ₪511.06
You save:  ₪146.02
₱5,561.09
List Price:  ₱7,785.75
You save:  ₱2,224.66
¥14,911.76
List Price:  ¥20,877.07
You save:  ¥5,965.30
MX$1,670.32
List Price:  MX$2,338.52
You save:  MX$668.19
QR364.82
List Price:  QR510.77
You save:  QR145.94
P1,359.04
List Price:  P1,902.71
You save:  P543.67
KSh13,398.66
List Price:  KSh18,758.66
You save:  KSh5,360
E£4,718.65
List Price:  E£6,606.31
You save:  E£1,887.65
ብር5,656.15
List Price:  ብር7,918.84
You save:  ብር2,262.68
Kz83,512.74
List Price:  Kz116,921.18
You save:  Kz33,408.44
CLP$93,810.03
List Price:  CLP$131,337.80
You save:  CLP$37,527.76
CN¥710.61
List Price:  CN¥994.89
You save:  CN¥284.27
RD$5,917.87
List Price:  RD$8,285.25
You save:  RD$2,367.38
DA13,435.55
List Price:  DA18,810.31
You save:  DA5,374.76
FJ$226.69
List Price:  FJ$317.37
You save:  FJ$90.68
Q780.94
List Price:  Q1,093.35
You save:  Q312.40
GY$20,949.18
List Price:  GY$29,329.69
You save:  GY$8,380.51
ISK kr13,659.63
List Price:  ISK kr19,124.03
You save:  ISK kr5,464.40
DH1,002.67
List Price:  DH1,403.78
You save:  DH401.11
L1,768.33
List Price:  L2,475.73
You save:  L707.40
ден5,652.42
List Price:  ден7,913.61
You save:  ден2,261.19
MOP$805.88
List Price:  MOP$1,128.27
You save:  MOP$322.38
N$1,866.55
List Price:  N$2,613.25
You save:  N$746.69
C$3,681.10
List Price:  C$5,153.70
You save:  C$1,472.59
रु13,266.49
List Price:  रु18,573.62
You save:  रु5,307.13
S/368.83
List Price:  S/516.39
You save:  S/147.55
K382.06
List Price:  K534.91
You save:  K152.84
SAR375
List Price:  SAR525.02
You save:  SAR150.01
ZK2,508.19
List Price:  ZK3,511.57
You save:  ZK1,003.37
L456.04
List Price:  L638.48
You save:  L182.43
Kč2,310.02
List Price:  Kč3,234.13
You save:  Kč924.10
Ft36,211.46
List Price:  Ft50,697.50
You save:  Ft14,486.03
SEK kr1,038.11
List Price:  SEK kr1,453.39
You save:  SEK kr415.28
ARS$85,066.49
List Price:  ARS$119,096.49
You save:  ARS$34,030
Bs691.23
List Price:  Bs967.75
You save:  Bs276.52
COP$389,029.38
List Price:  COP$544,656.70
You save:  COP$155,627.31
₡50,979.09
List Price:  ₡71,372.77
You save:  ₡20,393.67
L2,470.17
List Price:  L3,458.33
You save:  L988.16
₲730,160.41
List Price:  ₲1,022,253.79
You save:  ₲292,093.37
$U3,841.23
List Price:  $U5,377.88
You save:  $U1,536.64
zł395.31
List Price:  zł553.46
You save:  zł158.14
Already have an account? Log In

Transcript

Of any episode that I do in this entire series, this is my favorite because this, my friends, is cryptography. Cryptography is the science, the study of taking data and making it hidden in some way so that other people can't see it, and then bringing the data back. So the big word we want to use when we talk about cryptography is taking some kind of information and providing confidentiality to that. Now, we do this through a number of different ways. But the magic word I want to use right now is obfuscation. obfuscation is to take something that looks like it makes sense, and to hide it, so that it does not make sense to the casual outside observer.

Now, there's a lot of different ways we can do obfuscation to provide confidentiality. One of the things we can do is diffusion. So here, here's a picture of my grandson right here. Let's take a look at that. That's Steven. Andy gorgeous.

So what I'm going to do is I'm going to diffuse this image and make it fuzzier. Now, in this particular case, we didn't diffuse it too much. So if you look at it, you could probably tell there's still a cute little kid there. And he is cute. But diffusion only allows us to make it less visible, less obvious. Now what we can also do is confusion.

So let's take that same image of Steven one more time, and just stir it up, let's just make a mess out of it. Now, in this particular case, we've created a lot of confusion of the image, it's basically stirred up, and it would be very difficult for somebody to simply look at this and go, Ah, that must be Mike's grandson, Steven. So the other challenge we have with cryptography is we go through this process of taking some kind of data, and we go through this obfuscation process. But and here's the important one is that we've then got to take this obfuscated data and some way bring it back into its original form. So So we call this encryption and decryption and cryptography is the process of making this happen. Cryptography has been around for a long, long time.

In fact, probably one of the oldest type of cryptography has ever been around is something called the Caesar cipher. 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 box of cereal, you get some kind of prize inside. And one of the things we get is called a secret decoder ring. So what I want to do here, let's Can we put up a picture of a secret decoder ring real quick. Okay, so this is a classic old school kids decoder ring. Now, what I want to do is I've made my own decoder ring right here.

And I'd like us to take a little peek at this guy. And what you're going to see here is I basically got a wheel with all the letters of the alphabet A through Z. And on the inside, I've got letters, the alphabet A through Z. So right now I've got them lined up at a B to B, C to C. Now what I can do to make a secret code is let's say I can turn this to I can rotate this two times. And what we can do is we can take our original plane information, what we call the plaintext, our message that we want to encrypt, and we just change the letters. So we call this substitution, what we'll do is we'll take one value and substitute for another.

Now in this case, I've rotated it twice. So we actually have a term for this, we call it our OT, two, just like that. And if I turned it three times, it would be our ot three now. So we can take like the word AC, AC, and I can change AC E to c, e. g, get the idea. So that's the cornerstone of the Caesar cipher. So to convert something with a Caesar Cipher, and Matter of fact, let's just go through the process real quick.

Now what I'm going to do, let's put A piece of plain text that we want to encrypt, we attack at dawn. So here it is, we attack a dog. Now first thing we're going to do get rid of all the spaces. So now just says we attack a dog very readable. We don't worry about upper lowercase in this particular situation. Now, let's go ahead and put our groovy little secret decoder ring up there.

And let's go ahead and turn it in this particular case, five times. All right, so we're doing an R ot five. So let's turn it 12345 times. So now what we can do is by using the secret decoder ring, we can go ahead and encrypt, we attack it gone as follows. So what we now have generated is a classic Caesar cipher. Now there's a problem with Caesar ciphers.

And the biggest problem we have with the more than anything else is that in fact, people buy crossword puzzle books, will pay money to be able to do this is that we can do crypt them, we can just by looking at them, we can provide what's known as crypt analysis. crypt analysis is breaking these encrypted codes. So the problem is, is that anybody who's good at these things could pretty easily crack this. So the Caesar Cipher even though it is a substitution cipher does have the problem is that it's just too easy to predict what this is because we're used to looking at words. So what I want to do is make it a little bit more challenging. The first thing I'd like to try to do is I want to bring in something called the VGA cipher.

The cornerstone of vision a cipher is that it's really just a Caesar Cipher with a little bit of extra confusion involved. So what I've got here is a table that shows all the possible Caesar ciphers there are. So here up at the top, we're gonna have the word plaintext. I'll show you how that works in just a minute. And then you'll see on the far left hand side It says zero through 25. So these are all the possible ROTC values you can have from ROTC, zero, which means a equals A B equals b, all the way down to ROTC 25.

So, what we're going to do, let's hold on to this for a minute. And now let's go ahead and start with a piece of plain text. Let's use we attack at dawn one more time. And what I'm going to do this time is we're going to apply a key, the key is simply a word that's going to help us do this encryption. In this particular case, I'm going to use the word face, F, AC E. Now what I'm going to do is I'm going to put f AC e above the first four letters of attack at dawn. So here we go f AC E, and then I'm going to just keep repeating that so we put face again, I'm going to put face again, and you'll see I've got two letters leftover, no big deal I'll just put FA and what we've done is we have applied a key to our plaintext.

Now what we're going to do is right We're going to use the key to change the Caesar Cipher ROTC value for every single letter. So let's go ahead and do this. Now what I'm going to do is I'm going to reference my little chart here. So the first letter of the plain text is the W and V. So here's the W up at the top, and the key value is F. So let's go down on the y axis here till we get to an F, then you see that F, you'll see the number five right next to it. So this is our ot five. So all I need to do is do the intersection of these, and we get the letter B.

Great. Let's do it again. Now in this case, the second time it's the letter E from V. And in this particular case, the key value is a which is kind of interesting because that's ROTC zero but that still works. So we start up at the top, find the letter E. Then we find a and in this case because it's ROTC zero, by coincidence, he is going to stay as he Let's do the third value. Now this time, it's the AES and attack. So we go up to the top, there's the letter A, and the key value is C as in Charlie, so we go down to the C, that's our ot two.

And we then see that the letter A is now going to be C. Okay, let's do one more real quick. In this particular case, it's the first tee and attack. So we come over to the T's. And now the key value is E as an ease and face. So we go down here, that's our ot four, we do the intersection, and now we've got an X. So the first four letters of our encrypted code is B EC x.

So let's go ahead and run through and do the rest of these real quick just put those in for you. And we have now encrypted in the vision a style. So the beauty of the visa de is that it actually gives us all the pieces we need to create a classic piece cryptography. Number one, we have an algorithm and the algorithm are the different types of Caesar ciphers and the rotations. And second, we have a key. And the key allows us to make any type of changes we want within our ot zero to our ot 25 to be able to encrypt our values.

Any algorithm out there is going to use a key in today's world. So when we're talking about cryptography today, we're always going to be talking about algorithms and keys. Now, the problem with division a is that Well, number one, it's surprisingly crackable. Isn't that interesting? But the bigger problem is, is VGA works just great for letters of the alphabet. Unfortunately, it's terrible for encrypting pictures or SQL databases or your credit card information.

In the computer world. Everything is binary, everything is ones and zeros. So what we need to do is come up with algebra. rhythms that provide the type of encryption and decryption, we need to encrypt and decrypt long strings of just ones and zeros. Now if you look at a string of ones and zeros, you go, how does anybody make anything out of this? Well, they do that there's you got a string of ones and zeros may look like nothing to you to a human being, but to Microsoft Word that could be a Word document.

Or it could be a voiceover IP conversation. Or it could be a database stored on a hard drive, I don't know. But just because as human beings, we look at long strings of ones and zeros and get confused, trust me that computers don't. What we need to do though, is we need to come up with algorithms, which unlike Caesars, or vegenaise, that will work with binary data. Now luckily for us, there are a lot of different ways to do this. So what we're going to do is I've got an example of a algorithm we're going to use that encrypts a simple phrase that we're going to we're going to convert Those are binary by the way.

And we're going to do this using a very interesting type of binary calculation called Exclusive OR, for our first encryption, I'm going to encrypt my name. So here's my name, Mike MKE. Now, the first thing we have to do is we're going to have to convert this to the binary that a computer would use. So I'm going to be using the binary equivalence of the these texts values. So let me go ahead and convert these into their binary equivalence. And anybody who's ever looked at ASCII code, or Unicode should be aware that we can convert these into binary.

Okay, so here we go. So here's MI, K, he converted into binary. Now notice that each character takes eight binary digits. So we got 32 bits of data that we need to encrypt. So that's our clear text. Now, in order to do this, we're going to need two things.

First of all, we're going to need an algorithm and then we're going to Need a key. Now keep in mind, what I'm making up is like the most simple version of encryption you can possibly do. So let's go ahead and first of all set up our algorithm. Now our algorithm is extremely simple using what we call an exclusive OR so here's the exclusive or this is what we call a truth table. So what I'm going to do is I'm going to choose because this mic algorithm arbitrarily chooses This is I'm going to be using a five bit key. Now, there's a reason I'm using a tiny, tiny short key like this in the real world.

Keys can be thousands of bytes long, but for right now, we're just gonna use a five bit key. So to make this work, let's start placing the key. So I'm going to put the key over the first five bits. So here at the letter M for Mike. And now we can look at this table and we can start doing the conversion. So let's convert those first two values, then the next, then the next.

Then the next. Okay, so now we've converted a whole keys worth but In order to keep going, all we have to do is flip that key right back up there. Okay? In fact, let's go ahead and extend the key all the way out book. So now the key, do we just keep repeating it. And you'll see here at the end, it doesn't quite line up, no problem, just add whatever amount of key you need to go ahead and fill up the rest of this.

So there we go. Okay, so now we can go ahead and complete this. Now, let's just do it fast. You can double check if you want. But as we go through here, using the exclusive OR algorithm, we then create our ciphertext. Go ahead and spot check a couple of those for me and make sure I got them right.

Okay, beautiful. Now, so this is the cipher text. Notice that we have an algorithm which is extremely simplistic, we have a key which is very, very simple In short, but we now have an absolutely perfect example of binary encryption. Now to decrypt this, we'd simply reverse the prime process. So I'm not going to go through all that, but appreciate that we would take the ciphertext, play the place the key up to it, and then basically run the algorithm backwards. And then we would have the decrypted data.

So even though we've only seen three types of encryption so far, keep in mind that these really do everything that we're going to be seen in later episodes just a lot more complicated. Now, a couple of things we need to think about here. First of all, what's interesting is if we always have an algorithm and a key, there's a gentleman named Auguste kerkhof, who came up with a very interesting concept. Kirk offs principle says this. As long as you don't know what the key is to an encryption, you can actually understand the algorithm completely. Now this is really, really important.

Today's big superduper encryption tools that we use out there to protect you on the internet are all open standards. Everybody knows How the algorithms work. Now you would think, wait a minute. Now, if I know how the lock works in essence, wouldn't I be able to pick it easier? And the answer is, interestingly enough, no, in our society by showing everybody the lock, everybody can check the lock to make sure it isn't pickable. So when we talk about proprietary encryptions, everybody gets nervous, because if we don't all know how the lock works, we can't all test the lock to make it work.

So Kirk offs principle, and something we stand to today simply says, everybody knows the algorithm. But if you don't know the key, it's not going to do you any good. So lastly, I want to talk about in cryptography basics is the idea of what data are we encrypting because in the IoT world, data is all over the place. The first place we might think about is what we call data at rest. Now data at rest simply means something stored on a hard drive or on optical media or on a thumb drive or whatever it might be. And indeed, These types of cases, we encrypt the data when we put it on to the drive itself.

So it sits on the stored media in encrypted format. The other one is called data in transit. 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 the internet's and all the different tubes. And is that data to be encrypted while the data is in transit or not? And this is a big issue. And the last one is data in process.

So we take a big database, and we pull it off of a hard drive and we start calculating on that database. So it's sitting in RAM or it's sitting in CPU. Those are important areas for us to consider when we're talking about cryptography. Where are we going to be encrypting and decrypting that data

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.