Placeholder Image

Subtitles section Play video

  • Let's delve into a s and talk about you know what's good about it, how it works and why it was judged good enough to be the advanced encryption standard.

  • So why yes.

  • Yes, yes, but what?

  • Yeah, Why?

  • I say yes.

  • Why Buying dollars a year?

  • Have you heard offline, doll Ryan Dole?

  • No.

  • No.

  • Okay, so in that perhaps slightly infuriating way I manage should not say anything about how it works.

  • In the last video, it'll let's start with a few numbers that we briefly mentioned in the last video.

  • A s is a 128 bit symmetric block cipher.

  • That means it takes 128 bits off message on encrypted into 128 bits off cipher text.

  • We have some key.

  • Now that key cannot ever be 128 192 or 256 bits on DDE.

  • That gives you just varying amounts of security.

  • Right?

  • Form loads to ridiculously close it.

  • So don't worry about it.

  • If you if you find your brows using 128 bit, that's okay.

  • These were specified as part of A s standard.

  • So Randall had to adhere to this.

  • But I just think that we're taking 16 bites at 128 bits and we're doing something to it that turns it into some cipher text.

  • And because this is an SP network, we're gonna be doing some amount off substitution or could bring in some confusion on some amount of permutation moving things around to add diffusion you don't want just like the Enigma Machine.

  • You don't want to have one bite in one bite out, because that's gonna be easier to analyze on in.

  • Historically, of course, it is.

  • Instead of having a long line of of bites, orbits like most Cyphers might arrange things.

  • A S likes to arrange things in a grit.

  • A four by four grid 428 bit.

  • So we have our message, which is 128 bit.

  • That's 16 bites as a four by four grid.

  • Every time I try and do a grid, it always goes well.

  • So bite naught is going to be in here on bite one and bite to and by three and then 45678 column major order.

  • So actually what we're doing is we're taking our 128 bit message and we're just laying it out in this order like this on dhe.

  • Then we're going to start doing RSP network gonna commute.

  • We're gonna substitute bites and then we're gonna transform it into some way where an attacker can't read what the message used to be.

  • So there are a few different operations that A s will do but remember, But everything in a s happens on this four by four grid.

  • So what we're going to do?

  • Remember, we got the SP network, we're gonna have a substitution permutation, and we're gonna add darkie and as well at some point.

  • So this is our plain text on.

  • We're going to first bring in a part of our key on within a performing excell operation we named Member.

  • We put in all K intermediate between the rounds to battle secrecy rest.

  • The album is fully published in public.

  • Then we're going to do all round, so that's gonna be substitute bites.

  • Then we're going to shift rose on their finally, we're going to mix columns on dhe.

  • This is gonna be our substitution, and this is gonna be our permutation.

  • And finally at the end of each round, we're going toe out our ki add around key like this, and then this is going to be one around.

  • And the only thing to mention is that the mixed columns is in all around except the last one.

  • Because this permutation has no effect on the last round.

  • It just commute.

  • The output doesn't make it doesn't make any difference.

  • So it's exactly like this, except for this one, is missing on the lost ground.

  • When you've got 128 bit key, you have 10 of these rounds.

  • When you have 192 bit key, you have 12 of these rounds on.

  • When you have a 256 Vicky, you have 14 rounds.

  • But in a world of regard for exactly the same, so this is also an ex or down here add round key.

  • We don't put the same key in every time.

  • What we do is we take the original key, and as I mentioned in the SP Network video, we expand it using something called a key schedule into different round keys.

  • So visibly sort of key naught.

  • Perhaps this will be key one key to and so on, depending on which round we were in.

  • And so there'll be a key that's expanded for every round.

  • We weren't talking too much detail about the key.

  • Schedule is quite simple.

  • On effect, it's just meant to be fast.

  • Mainly it just takes your your shorter key on expands it sufficiently such that you can put it in a different rounds.

  • That's an overview of what A s does.

  • This is a much, much, much better version.

  • I mean, I can't stress this enough a much, much better version than the one I designed or showed in my SP network video.

  • We're substituting, and then we're gonna commute, and then we're gonna mix in our bounty on.

  • We're gonna do this over and over again until we have a cipher text.

  • So I guess the question then becomes what happens here, here and here off interest?

  • What's particularly nifty for me about yes, is that it doesn't use the same kind off operations that you might expect so X or, of course, happens everywhere in cryptography.

  • But actually, all of the operations within A s are essentially mathematical operations.

  • On what we would call a finite field.

  • So Dave talked a little bit about Gallo.

  • Our fields in his read Solomon video on the answer is by using Gallo our fields theory over finite feels and doing lots and lots of long divisions on traditions for a finite field or gal.

  • Our field, which are interchangeable names they What you have in the field is you have some some number of elements.

  • So let's say all the numbers between Norton 10 for example, and you have different operations, you can perform on that field.

  • So in mind are we have a gala Warfield off to to the Eight Elements.

  • And then in this field, weaken do addition, subtraction, multiplication on dhe division or extra two minus one inversion.

  • The important thing to remember about final field if we don't go any further with the math at all is that to ta elements is a bite, right?

  • So each element in this callow a field is just a bite.

  • So we start with north North Lord Lord Lord Lord, Lord Lord, we go away.

  • 211111111 And so there are 256 off these elements in this particular finite field.

  • The one take home message that you need to know about this even if you don't ever look at it again, is that whichever of these operations we do?

  • We produce another element in this field.

  • But we never leave the field.

  • We never overflow.

  • We never under flow and go into negative numbers, anything.

  • There's no float representation, anything like this.

  • If we take one of these numbers and we add them to another one, we find a different one.

  • And if we multiply them or inverse invert them or divide, we go to a different one.

  • Which makes it quite nice for imprinting a cipher because a lot of these have an opposite.

  • So, for example, addition and subtraction under each other, modification and inversion or dividing, they undo each other.

  • And we could move around this field.

  • But we never actually Levi bites.

  • If we've got our four by four by representation of our data path in A s.

  • This is our 128 big block.

  • We can perform informations on here within this final field and by the end will still be in the final field.

  • We won't have gone over to 130 bits 140 bits or somebody's officer like that.

  • It'll bring died around back.

  • And with that in mind, we will talk about what each of these does.

  • Substitute bite fats off.

  • Substitution box is literally a lookup table.

  • It's a cleverly designed lookup table.

  • Them just made this up.

  • Each bite is map to a different bite based on a function in this field.

  • But most importantly, there's a few.

  • There's a few things that they've done to try and designed it to be as complicated as possible.

  • So it's very non linear, so it's very difficult to kind of represent.

  • This is a mathematical function, exactly what it is that it does.

  • Let's just do one and then waken see So we've got our grid.

  • Let's put this here.

  • We've got our grid now drawn many times.

  • This'd be zero Mrs B one all the way up to be 15.

  • Now, what we're gonna do is we're gonna take this bite.

  • We're gonna look it up in our table.

  • We're gonna replace it with a different one, right, So are substituted.

  • Bite like that.

  • We're gonna do that individually for each of these to make this function more confusing.

  • It's been designed such that there were no fixed points.

  • That means no bite.

  • It's substituted with itself.

  • So you don't start with 15 end up with a 15 and there were no opposite fixed points, which means all the bits flip.

  • So, for example, the opposite off 1010 would be Owen Owen.

  • My ambitions for a whole byte data exist in this has been designed that way.

  • So this substitution box is really quite powerful.

  • Andi is one of the reasons why this is a really good out room, as it happens.

  • Also, it's just a lookup table.

  • So it's nice and quick, fast reversing.

  • What?

  • So we've substituted our bikes, We've taken our plain text, we put in part of our round key or this is our initial key, and then at the beginning around will make some bite.

  • Substitution is using arrest box.

  • Then we're gonna shift the rose.

  • This is really straightforward.

  • So we're just gonna take the first round, do nothing to it.

  • We'll take the second row.

  • We're gonna move it one to the left.

  • So be one go whole way back over to hear the wraparound fist move this way and this moves this way and this moves this way and this is a ghost.

  • In the end, this row moves too.

  • So this goes to hear this goes to hear this goes round back to here and so on on this moves three, which is another way of saying it was that way, but yeah, So this one goes all the way over here, this one goes over to here and so on.

  • So remember, this is going to be an intuitive process, and what we want to do is move these things around and commute them.

  • So if this is our data path with our columns by sharing bites around different columns, when we combine it with the mixed column step, which will do in a minute, you'll see the actually, we're mixing everything up.

  • So we've been just a couple of rounds.

  • Everything is very, very jumbled up, and that's a really good thing, because it's gonna be much, much harder to break.

  • So we're just taking bites and we put them in a different place in this grid.

  • So that brings us to mix columns, which goes along with this s so now that we've moved things into different columns, what we're going to do is going to take this column here and we're gonna mix.

  • He's right up.

  • We'll take this column, mixes right up on this one and this one separately.

  • So this is a column wise operation.

  • So this bite has gone over to here and then been mixed into this column.

  • This one has gone over to here and be mixed into this column.

  • So these two operations together are, you know, they're doing a good job off jumbling everything up.

  • It will be my technical way of putting it.

  • This is going to be done using the matrix multiplication.

  • So let's just turn it off.

  • Go for a lot of your paper today for some column.

  • Let's say see, naught.

  • See one C to C three.

  • We're gonna multiply as a vector by a matrix.