CPSC 253 - Lecture 4/5: Advanced Encryption Standard

0.0(0)
Studied by 32 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/46

flashcard set

Earn XP

Description and Tags

- Bytes are 4 words, salient features of aes should all be reviewed, especially subsitution and the other one. Four processing steps in each round

47 Terms

1
New cards

Steps in AES processing rounds for encryption

1) 1 single-byte based substitution step

2) Row-wise permutation

3) Column wise mixing step

4) Addition of a round key(XoR operation, use with input block)

  • Order is different for encryption and decryption

  • Word: 4 bytes,


2
New cards

What is the block size of a block cipher input in AES?

  • 128 bits.

    • Fixed, cannot change


3
New cards

How does AES encryption round amounts change based on key size?

  • 10 rounds of processing for 128 bit keys

  • 12 rounds for 192 bit keys

  • 14 rounds for 256 bit keys

  • Identical rounds excluding the last round which has a different key, put everything back to 128 buts


4
New cards

Processing steps in 1 round(AES)

  • After a 1st block goes through all the rounds, the processing goes block by block, column by column

  • 16 bytes * 8 bits = 128 bits

  • The 128 bit block is a 4×4 matrix of bytes

  • 1st 4 bytes occupy the 1st column and so on


5
New cards

State Array

  • 4×4 bytes matrix of bytes/a block

  • Input for AES

  • Each block is repped by a 4×4 matrix, columns numbered starting at w0


<ul><li><p>4×4 bytes matrix of bytes/a block</p></li><li><p>Input for AES</p></li><li><p>Each block is repped by a 4×4 matrix, columns numbered starting at w<sub>0</sub></p></li></ul><p></p>
6
New cards

AES Words

  • 4 bytes/32 bits = 1 word

  • Each column/row of the state array is a row

  • Each processing round takes the inout state array and produces an output state array

  • This output is rearranged into a 128-bit output block


7
New cards

Substitution

Confusion: Relationship between key and ciphertext being obscured is the goal


8
New cards

Permutation

Diffusion: Influence of 1 plaintext symbol is spreadover many ciphertext symbols with the goal of hiding statistical properties of the plaintext (original message)


9
New cards

MixColumns/InvMixColumns

  • Step 3 in encryption

  • Step 4 in decryption

  • Word level, every column is a word

  • Mixes up bytes in each column seperately

    • Each byte in a column is replaced by two times that byte, plus three times the next byte, plus the byte that comes next, plus the byte that follows using XOR operations

  • Goal is to scramble up 128 bit input block


10
New cards

SubBytes/InvSubBytes

  • 1st step in encryption

  • 2nd step in decryption

  • Goal is to reduce correlation between input and output bits at byte level

  • Bit scrambling ensures substitution can’t be described in simple math function

  • 1 single-byte-based substitution (Byte level), byte by byte using a rule that stays the same for all rounds

  • 8 bit binary numbers

  • Uses a 16×16 lookup table to find a replacement byte for the given one in the input state array(traditional way)


11
New cards

Traditional way for byte substitution

  • 16×16 lookup table

  • Divide input byte by 2 4-bit patterns to find substitution bytes to get a value between 0-15

  • Repped by hex values between 0-F

  • 1 value is the row index and the other is the column index for the table

  • Always use 4 bit binary numbers

  • Results in 256 byte state array/lookup table


12
New cards

What is the purpose of a Lookup table?

  • Substitution step(confusion) is done to reduce correlation between input and output bits at the byte level


13
New cards
<p>Characteristics of constructing an S-box for AES encryption/decryption with Byte Substitution</p>

Characteristics of constructing an S-box for AES encryption/decryption with Byte Substitution

  • Hexadecimal numbers, 4 bits each

  • GF(2^8) create unique 8 bit binary numbers based on multiplicative inverse

  • For 0×00 there’s no multiplicative inverse, it replaces itself

  • Bit scrambling to destroy bit-level correlations in each byte

  • The table made is 16×16 lookup, same for all bytes in the state array

  • Steps that go into this are reversed for the decryption table

    • 1st use reverse of bit scrambling to each byte and then use multiplicative inverse


14
New cards
<p>In thhis table, if a byte in cell (9,5) is the multiplicative inverse of 0×95, what number is it?</p>

In thhis table, if a byte in cell (9,5) is the multiplicative inverse of 0×95, what number is it?

0×84

15
New cards
<p>Bit scrambling for encryption</p>

Bit scrambling for encryption

  • 0×00 byte is changed with this, use XoR operation on right column with a column of 0s

  • This transformation is applied to each bit b of the byte stored in a lookup table

  • ci is the ith bit of a byte c with hex calue 0×63

    • 4 of the digits represent 6, other rep 3 for the far right column

  • Breaks correlation between bits before and after substitution


16
New cards

Implementation of AES in python

  • statearray = [[0 for x in range(4)] for x in range(4)]

  • Thanks to the nature of substitutions and permutations in AES, it can be implemented quickly as software


17
New cards

AES vs. Rijndael cipher

  • Rijindael works with any block and key size that’s a multiple of 32 & > 128

    • AES needs a 128 bit block size

  • The state array for the different block sizes still has only four rows in the Rijndael cipher.

  • However, the number of columns depends on size of the block. For example, when the block size is 192, the Rijndael cipher requires a state array to consist of 4 rows and 6 columns.


18
New cards

How does substitution for AES and DES differ?

  • AES uses a substitution-permutation network in a more general sense.

  • Each round of processing in AES involves byte-level substitutions followed by word-level permutations.

  • Speaking generally, DES also involves substitutions and permutations, except that the permutations are done by dividing the input block into two halves, processing each half separately, and then swapping the two halves.


19
New cards
<p>What is being portrayed in this image?</p>

What is being portrayed in this image?

Four words of the original 128-bit key are expanded into a key schedule consisting of 44 words with Key Expansion Algorithm. Key schedule has all 44 words.

20
New cards
<p>What is this image depicting?</p>

What is this image depicting?

  • Overall structure of AES for a 128 bit encryption key

  • Goes through 10 rounds

  • 4 words

  • w0-w3: Input and key block added, The user suppiled key

    • XOR with the input block. The preprocessing step

  • Round 1: Take the 4 w’s and repeat until the end, moving 4 w’s each time until reaching 44 w’s


21
New cards

AES Pre processing step

  • Input state array is XORed w/ the 1st 4 words of the key schedule

  • Also happens during decryption except you use the ciphertext state array with the last 4 words of the key schedule


22
New cards

Steps in AES processing rounds for dencryption

1) Inverse shift rows

2) Inverse substitute bytes

3) Add round key

  • XOR the output of the previous 2 steps

4) inverse mix columns


23
New cards
<p>What is this figure depicting?</p>

What is this figure depicting?

1 round of AES encryption

24
New cards
<p>What is this figure depicting?</p>

What is this figure depicting?

1 round of AES decryption

25
New cards
<p>ShiftRows/InvShiftRows</p>

ShiftRows/InvShiftRows

  • Aims to scramble the byte order in each 128-bit block for AES

  • For encryption this is the 2nd step

  • For decryption it’s the 1st

  • Affects state array

  • 1st row is unshifted

  • 2nd is shfited 1 byte to the left

  • 3rd is 2 bytes to the left

  • 4th is 3 bytes to left

  • Array is written column wise

  • In decryption, same shifts but to the right


26
New cards
<p>Understanding a lookup table</p>

Understanding a lookup table

  • For a cell located at (2,7) you place hex 0×27 in that cell

  • Replace the next value in each cell with its multiplicative inverse in GF(2^8)

  • The byte stored in (9,5) is the multiplicative inverse of 0×95 which is 0×8A

    • IT stores 10001010 implying the MSB(b7 is 1 and b0 is 0


27
New cards
<p>Importance of the c byte(value: 0×63)</p>

Importance of the c byte(value: 0×63)

  • For byte substitution to be invertible the byte-to-byte mapping by the 16 × 16 table must be one-to-one.

  • For each input byte, there must be a unique output byte. And, each output byte must correspond to only one input byte.

  • No input byte should map to itself, would make the cipher weak

  • Multiplicative inverses gives unique entries for each input byte

  • Hex value 0×00 is replaced by itself because it has no multiplicative inverse

  • Without this, the bit scrambling step would also leave the input byte 0x00 unchanged. With the affine mapping shown above, the 0x00 input byte is mapped to 0x63. At the same time, it preserves the one-to-one mapping for all other bytes.

  • c7…..c0 = 01100011

  • Used in encryption


28
New cards
<p>Bit scrambling for decryption</p>

Bit scrambling for decryption


  • After transforming each cell:

  • di is the ith bit of a specially designated byte d with hex value 0×05(d7 d6 d5 d4 d3 d2 d1d0 = 00000101)

  • Replace the byte in the cell with its GF(2^8) multiplicative inverse


29
New cards

Purpose of c and d bytes

  • No fixed points in S-box

  • Ex: S_box(a) = a should not be true

  • Ex: S_box(a) = ā indicates a fixed point with a bitwise complement, also undesirable

  • So if A=00001111

  • a complement is = 11110000

    • Can lead to weakness in the system


30
New cards

AddRoundkey/InvAddRoundKey

  • XOR each byte of the input blocks with each byte of the key block

  • Same as XOR state array w/ key

  • 4th step of AES encryption

    • XOR input of 3 previous steps with 4 words

  • 3rd decryption step

    • XOR input of previous 2 steps with 3 words

  • Adding round constants destroys any possible symmetry

  • Different key for each round


31
New cards

‘Next’ and ‘Follow’ in MixColumns/InvMixColumns

  • Refers to bytes in the same column, and their meaning is circular, in the sense that the byte that is next to the one in the last row is the one in the first row.

  • In a column, end loops back to top.


32
New cards
<p>What is this image depicting?</p>

What is this image depicting?

  • The 2nd block is the output of row-wise permutation from the previous step

  • Results in a new input block before adding the round key

  • MixColumns/InvMixColumns


33
New cards

Galois Field

  • Always XOR

  • Finite Field


34
New cards
<p>AES Key Expansion Algorithm</p>

AES Key Expansion Algorithm

  • What prevents ___ from having weak keys

  • Used to derive the 128 bit round key and expand it into a key schedule

  • If one bit of the encryption key changes, it should affect the round key

  • Each round’s key has a key derived from original

  • XOR the round key with the state array

  • Arranged in the form of a state array with the 1st 16 bytes of the encryption key in a 4×4 array of bytes

  • 4 columns words in key matrix are then is expanded until 44 words creating a ____ for 10 rounds

  • 1st 4 words are bitwise XOR with input block before round based processing


35
New cards

Decryption in Key expansion algorithm

  • Use words in key schedule in reverse order


36
New cards
<p>How are 4 words expanded into 44 in the Key Expansion Algorithm?</p>

How are 4 words expanded into 44 in the Key Expansion Algorithm?

  • Expanded on a 4 word to 4 word basis

  • w0-w3: og key

  • g: A special function taking the last word from the previous steps and processes it


37
New cards

Function g()

  • Performs a 1-byte left circular rotation on the argument 4-byte word

  • Perform a byte substitution for each byte of the word pe

  • Used on the last word in a round


38
New cards

Round constant

  • Word whose 3 rightmost bytes are always 0

  • Rcon[i] = (RC[i], 0x00, 0x00, 0x00


39
New cards

Key Expansion Algorithm with keys >128 bits

  • Input length block stays the same

  • 192 bit keys: 52 words

    • 9 expansion steps create 54 words, last 2 can be ignored

  • 256 bit key: 60 words

    • 8 Expansions?(Slides 21-22)


40
New cards

Weak Keys

  • Reduces Cipher Security in a predictable manner

  • Produce identical round keys for each of the 16 rounds

  • Common in DES

  • EX: An alternating key of 1’s and 0’s (01010101)

  • All the round keys are identical, now it is self inverting encryption

  • Encrypting plain text twice gives plain text


41
New cards

Two/three times

Multiplications in GF(2^8) by bit patterns 000000010 and 00000011,

42
New cards
<p>What is being shown here?</p>

What is being shown here?

  • Column operations

  • On the left, when a far left matrix row multiples a column of the state array matrix the addition is XOR operations


43
New cards

Which steps in AES encryption are performed at word level?

  • Row-wise Permutation

  • Column-Wise mixing


44
New cards

Which steps in AES encryption are performed at byte level?

  • Substitution


45
New cards

XOR operation

  • 0 ⊕ 0 = 0

  • 0 ⊕ 1 = 1

  • 1 ⊕ 0 = 1

  • 1 ⊕ 1 = 0


46
New cards

What key lengths are allowed in AES?

  • 128, 192, and 256 bits.

    • Mostly assume it’s 128-bit.

    • For other than 128 bits,the main difference is how the key schedule is generated from the key, determining handling


47
New cards

10/27/26 review

8 bits = 1 byte

  • In 16×16 table least sig bit is at the top

    • Matrix multiplication

    • + are XOR operations

    • XOR result w/ 3 and 6 to get final output to replace 1st byte and beyond in lookup table

  • Know how matrix operations work

  • How key expansion algorithm/schedule works and changes with different key sizes

  • Round constant

  • Slide before one way and strong collision resist slide(and that one too)

  • long parity check

  • Security column is most important

  • Word size isn’t

    • In last 2 columns even after 2^n messages still .5 collinsion chance

    • Increase hashes or number of messages

  • DO examples