now that we've talked a little bit about how authentication works now we need to jump into our encryption. So let's talk encryption
the process of how we take data that's in clear text, and we change it to something that's called Cypress text
Now. Clear text is data that anyone can read its date not necessarily weaken. Read if we looked at the raw data, but it's dated that if it's a password and we can look at it, we say, Oh, that says password. It's data that if our program, if our Microsoft Word looks at it, it says, Oh, this is a document I can read this
or a wire shark can look at it and say, Oh, this is http traffic.
Clear text is data that we that is able to be read by anyone. It's not sent from one person to another, necessarily. Or if it is, it's data that hasn't been changed any anyway. Anyone who can capture that packet.
Anyone who convened that file can just open it right up and see it just like anyone else.
So that's clear. Text cipher text is what happens to that data when we put it through an encryption and it comes out all scrambled up.
It's like if we are cipher, text is the end result of taking our clear text, putting it through some sort of encryption algorithm. And then out of the other end, we get a scrambled up bunch of data that unless you know how to decrypt the data, you're not going to be able to read it
if you try to open it up. If you take a Microsoft Word document
and encrypt it and then try to read it with Microsoft Word, then it'll come up as if it doesn't recognize it as being encrypted. It will say that the doctor won't even recognize the document is being a dot D O. C. It'll tell you it's encrypted or will say that the file is corrupted because it doesn't think see it as being in any format that it can recognize.
It's just a whole bunch of jumble of code
because we essentially took that code and we jumbled it up and encrypted it somehow.
So our goal is cipher text
cipher text is what we want to send over our network.
It is what how We want to store our sensitive data when it's in places that people can read it
if we're sending data across the network. If we're sending our user name and password across the network, we want our user name and password to be encrypted. A cipher text. We don't want to send user names and passwords across an open network
as clear text, because anyone who's connected to that network could just see art in user name and password.
We want to take our user name and password. We want to take our documents. We want to take any of the files or any of the folders that we're sending across the public network and equip them so that the only person who can read them is the sender and the person who's receiving it on the other end. That's the goal of encryption, and that's what we're about to talk about.
Now. Encryption decryption is accomplished with mathematical algorithms. If you if encryption is something that you find really exciting and you really get into encryption, encryption is a lot of very high level math. We're gonna We're gonna dip into the math just a little bit, but I know that
all of our files and all of our code on computers
are all at the very base, just numbers
at the very base, all of our code and all of our all of our code is just sequences of numbers. So all of our files just a bunch of numbers that are displayed as that we see displayed as our characters, even our letters are really just numbers.
we need to understand that we can use these mathematical out algorithms for for passwords that include uppercase letters, lower case letters, numbers and even special characters. Because all of those things are represented by different numbers, and we take those numbers and we put them through our mathematical encryption algorithm
and then out of the other side, we get
So we base our encryption and decryption on mathematical algorithms. And many of these mathematical algorithms, going into a little bit of an advanced topic, are based off of large, random prime numbers. The keys that we use in order to do decryption and encryption are based off of large, randomly generated prime numbers.
Because prime numbers,
there's really no, there's really no formula that we have out there for predicting or for predicting exactly how many prime numbers there are. Predicting all of the prime numbers. We have to manually go through an illiterate and see and check and see if certain numbers or prime numbers. So we use these very large prime numbers in these mathematical algorithms
in order to encrypt and decrypt our data.
the algorithm that we use
are mathematical algorithms that we use when we encrypt and decrypt data are common knowledge, the algorithms themselves, the actual process that we take the data and run it through our common knowledge, the things that we don't know the things that our secret to just the cinder and the receiver is something called
So the algorithm stays this if you're using the same type of encryption for me if you're using the same encryption type if you're using the same encryption standard. For example, if you're using an A E s encryption or you're using a T kip encryption,
the encryption algorithm
worldwide. That's what mathematicians spend years developing is the algorithm.
The thing that changes is the key,
and the key is what unlocks your data. The key is what you use to actually encrypt the data. So you take your data in numerical format and you take your key in both of those values. Go into your algorithm to get your cipher text.
So let's talk. Let's take a look at that. An example of this. Let's see if we can explain this a little bit better in a very, very simple algorithm that we have here.
So this is just a very simple This is a very, very simple algorithm. This is the type of algorithm that you would see on. This is similar to like the little decoder rings that you may have had as a kid, where you have the entering in the outer ring and you change the outer ring so that a equal see or or
a equals E, or whichever your algorithm is,
and then you change it to that and that you have your substitution algorithm and then you just swap. You swap your letters out, and that's how you encrypted your messages when you when you are using your decoder ring as a kid. So this is this is sort of our simple computer version of this. So
we talked about how all of our characters and all of our symbols
across the board are all represented by numbers.
These we've we've taken these characters and we've shown the asking representation of those characters.
Asking is a standard. It's a standard for what? A character on a screen, the numerical value for that character on the screen. There's other standards that will give us a lot more usage of different numbers of different types of characters and different symbols. But
one a very basic. And one of the first standards that we used was the asking statement standard
where every single, every single letter and every single number we have a different numerical value for. And we use those numerical values in computers because computers can't understand a capital P or an A or an S o N S r w. We can't understand that we can't save that in memory.
We can Onley save and we can only use
numbers. We can't use letters well, way can use letters and mathematical algorithms, but we aren't. We can't make actual computations with just number with just letters. We actually have to have numerical values and substitute into those mathematical algorithms. So we need.
So we use the default asking character are the asking values
of our letters here?
So this is what our computers doing behind the screen
Our behind the scenes
say we're tryingto often we're using are very simple algorithm that we developed and we're trying to authenticate ourselves to a remote server.
So we're having to send our password over the We're having this in a password over a public network.
Well, we don't want to send When are when the server asks us for our password. We don't want to send capital P A S S W zero r D in the clear over our network. Someone convey very easily Pick that up, see a password and then use it later. We don't want to do that. So we want to equip this before we send it.
So let's take a look at our numerical values are asking values for our characters
in asking a Capital P is 80. A lower case P is actually a different number, so capitals and lower cases have different values.
A Capital P is 80 lower case a is 97 s lower case is won 15 w lower case is 1 19 0 is 48 r is 114 Indy is 100.
these numerical values for our data,
this is the data. This is our clear text data.
So that's the first component of our encryption. We need our data.
The next component of our encryption is our algorithm.
So we spent years and years and years, and we developed our very complex mathematical algorithm of plus
which is not a very complex mathematical algorithm at all. If you haven't guessed by now.
Now, what do we substitute for Kay? Because we can't add K. We can't do a K 97 Kate. That doesn't make sense.
We need to have a key.
And Archy is what we substitute for Kay.
So our algorithm is plus K, and then R key
is 10. And remember, our algorithm stays the same. Archy is what changes.
So we already we have a shared key. So we told we already told our server when we set it up. If I send you data,
you're going to be, it's going to be using this algorithm, and it's going to be using the key of Tim
so later I could change the key to 20. Or I could change the key to five. But right now, the key is 10. So the key is secret.
The algorithm is not. Everybody knows our algorithm. This is the This is the Anthony Simple
encryption algorithm. And it is. The algorithm is plus kit plus key,
plus whatever Mikey is. And in this instance, Mikey is 10.
So we have our three components that we need.
our value, our decimal values of our asking characters. We have our algorithm plus que.
And we have our key 10. So 10 equals K.
So now we're gonna take each of our values. We're gonna add 10 to 80. So we're gonna get 90
1 25 1 25 1 29 58 1 15 in 110
So if we sent this data, if we sent
this data right here
would be our encrypted password.
we send this data over the network are passwords encrypted,
and then on the other end when the several receives are encrypted. Password is going to reverse our algorithm and it's going to do minus K because it knows our encryption algorithm is plus K and R decryption algorithm is minus K, and it knows that our key is 10 because we already shared a key to it before this session.
So I was just going to subtract
10 from all of these values and get our password. And now it knows what a password this.
So that's our very simple mathematical algorithm. Um,
it's not a very good one, because it could very easily be we could very easily just spoof this packet we could just send. We could see the encrypted packet and just spoof it, but it's it'll do for our example. But just know that mean for our
that in our example here are example shows that you for an algorithm to work for our encryption toe work. We need data,
we need an algorithm and we need a key.
The data and the key are different.
The algorithm is what stays the same. So the algorithm is the same worldwide in our data, in our key change,
and then up here we have our clear text
We have our encrypted Cypher text. So
now that we have an idea of how encryption works and now we haven't now that we have a math Matt, a little bit of a mathematical idea of how encryption works, let's move on and let's talk about our symmetric versus asymmetric encryption.