Foundations of Security Week9 Lecture

2199 字
11 分钟
Foundations of Security Week9 Lecture

Lecture Outline#

  1. Review of DES 16-round encryption process - Final Part
  2. S-box substitution in DES
  3. P-box permutation in DES
  4. Generating the final DES ciphertext
  5. Security limitations of DES
  6. Introduction to Advanced Encryption Standard (AES)

Learning Outcomes#

By the end of this lecture, students should be able to:

  1. Perform basic S-box calculations in DES encryption
  2. Perform the P-box permutation in DES
  3. Understand how the final ciphertext is generated in DES
  4. Explain why DES was replaced by AES
  5. Describe the key characteristics of AES encryption
  6. Explain the main transformation steps used in AES encryption

Data Encryption Standard (DES)#

S-boxes (Substitution)#

16 Rounds of Processing - Subkey Mixing#

F(R0,K1)F(E(R0),K1)F(\textcolor{blue}{R_0}, \textcolor{blue}{K_1}) \textcolor{purple}\longrightarrow F(\textcolor{red}{E(R_0)}, \textcolor{blue}{K_1})

E(R0)K1E(R_0) \oplus K_1 E(R0)=011110 100001 010101 010101 011110 100001 010101 010101\colorbox{#FFF2CC}{$\textcolor{red}{E(R_0)} \textcolor{black}{= 011110 ~ 100001 ~ 010101 ~ 010101 ~ 011110 ~ 100001 ~ 010101 ~ 010101}$}
\textcolor{purple}\oplus
K1=000110 110000 001011 101111 111111 000111 000001 110010\colorbox{#E2F0D9}{$\textcolor{red}{K_1} \textcolor{black}{= 000110 ~ 110000 ~ 001011 ~ 101111 ~ 111111 ~ 000111 ~ 000001 ~ 110010}$}
E(R0)K1=011000 010001 011110 111010 100001 100110 010100 100111\colorbox{#FBE5D6}{$\textcolor{black}{E(R_0) \oplus K_1 = 011000 ~ 010001 ~ 011110 ~ 111010 ~ 100001 ~ 100110 ~ 010100 ~ 100111}$}


16 Rounds of Processing - S-boxes (Substitution)#

The 48-bit result is divided into eight 6-bit chunks. Each chunk is passed through one of eight S-boxes (lookup tables), which map 6 bits to 4 bits, reducing the total to 32 bits (8×4=328 \times 4 = 32).

We now compute

S1(B1)   S2(B2)    S3(B3)    S4(B4)    S5(B5)    S6(B6)    S7(B7)    S8(B8)

S-box 1 (S1)
1441312151183106125907
0157414213110612119538
4114813621115129731050
1512824917511314100613

S1

1441312151183106125907
0157414213110612119538
4114813621115129731050
1512824917511314100613

S2

1518146113497213120510
3134715281412011069115
0147111041315812693215
1381013154211671205149

S3

1009146315511312711428
1370934610285141211151
1364981530111212510147
1101306987415143115212

S4

7131430691012851112415
1381156150347212110149
1069012117131513145284
3150610113894511127214

S5

2124171011685315130149
1411212471315015103986
4211110137815912563014
1181271142136150910453

S6

1211015926801334147511
1015427129561131401138
9141552812370410113116
4321295151011141760813

S7

4112141508133129751061
1301174911014351221586
1411131237141015680592
6111381410795015142312

S8

1328461511110931450127
1151381037412561101492
7114191214206101315358
2114741081315129035611

16 Rounds of Processing - S-boxes (Substitution):

Step-by-Step Example: Compute S1(B1)\textcolor{red}{S_1}(B_1)
If B1=011000B_1 = \textcolor{green}0\textcolor{purple}{1100}\textcolor{green}0

To compute S1(B1)S_1(B_1):

➤ First, determine the row number by using the first and last bits of B1B_1:
0\textcolor{green}0 (first bit) and 0\textcolor{green}0 (last bit) \rightarrow Row = 002\textcolor{green}{00}_2. Convert to decimal = 0\textcolor{green}0

➤ Next, determine the column number using the middle 4 bits of B1B_1:
Bits = 1100\textcolor{purple}{1100} \rightarrow Column = 110021100_2 . Convert to decimal = 12\textcolor{purple}{12}

➤ From the S1-box table, the value at row 0 and column 12 is 5. Convert to binary = 01010101. Therefore, S1(B1)=0101\textcolor{red}{S_1}(B_1) = 0101

Column
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
S-box 1 (S1)
Row 0 14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7
1 0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8
2 4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0
3 15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13





Computing all S-boxes

S1(B1)S2(B2)S3(B3)S4(B4)S5(B5)S6(B6)S7(B7)S8(B8)010111001000XXXXXXXXXXXXXXXXXXXX\begin{array}{cccccccc} % 8列居中对齐:*{8}{c} = 8列 + 居中(c=center) \color{red}S_1\color{black}(B_1) & \color{red}S_2\color{black}(B_2) & \color{red}S_3\color{black}(B_3) & \color{red}S_4\color{black}(B_4) & \color{red}S_5\color{black}(B_5) & \color{red}S_6\color{black}(B_6) & \color{red}S_7\color{black}(B_7) & \color{red}S_8\color{black}(B_8) \\ 0101 & \color{red}1100 & 1000 & \color{red}\text{XXXX} & \text{XXXX} & \color{red}\text{XXXX} & \text{XXXX} & \color{red}\text{XXXX} \\ \end{array}

P-box (Permutation)#

16 Rounds of Processing - P-box (Permutation):#

  • P-box (Permutation): The 32-bit S-box output is permuted using a fixed permutation table (P-box).


16 Rounds of Processing

L0=1100 1100 0000 0000 1100 1100 1111 1111\textcolor{red}{L_0} = 1100~1100~0000~0000~1100~1100~1111~1111
R0=1111 0000 1010 1010 1111 0000 1010 1010\textcolor{red}{R_0} = 1111~0000~1010~1010~1111~0000~1010~1010

We have
K1=000110 110000 001011 101111 111111 000111 000001 110010} 48-bit\colorbox{#E2F0D9}{$\textcolor{red}{K_1} = 000110~110000~001011~101111~111111~000111~000001~110010$} \hspace{1em}\textcolor{red}\}\text{~48-bit} L1=R0=1111 0000 1010 1010 1111 0000 1010 1010} 32-bit\colorbox{#E7E6E6}{$\textcolor{red}{L_1 = R_0} = 1111~0000~1010~1010~1111~0000~1010~1010$}\hspace{1em}\textcolor{red}\}\text{~32-bit} R1=L0F(R0,K1)\colorbox{#FBE5D6}{$\textcolor{red}{R_1} = \textcolor{red}{L_0} \textcolor{purple}\oplus F(R_0, K_1)$}


L0=1100 1100 0000 0000 1100 1100 1111 1111R0=1111 0000 1010 1010 1111 0000 1010 1010L1=R0=1111 0000 1010 1010 1111 0000 1010 1010F(R0,K1)=0010 0011 0100 1010 1010 1001 1011 1011}32-bit\left. \begin{aligned} \textcolor{red}{L_0} = 1100\ 1100\ 0000\ 0000\ 1100\ 1100\ 1111\ 1111 \\ \textcolor{red}{R_0} = 1111\ 0000\ 1010\ 1010\ 1111\ 0000\ 1010\ 1010 \\ \colorbox{#E7E6E6}{$\textcolor{red}{L_1} = \textcolor{red}{R_0} = 1111\ 0000\ 1010\ 1010\ 1111\ 0000\ 1010\ 1010$} \\ \colorbox{#E2F0D9}{$F(\textcolor{blue}{R_0}, \textcolor{blue}{K_1}) = 0010\ \textcolor{red}{0011}\ 0100\ \textcolor{red}{1010}\ 1010\ \textcolor{red}{1001}\ 1011\ \textcolor{red}{1011}$} \end{aligned} \color{red}\right\} \textcolor{red}{32\text{-bit}}

We can now compute
R1=L0F(R0,K1)\colorbox{#FBE5D6}{$\textcolor{red}{R_1} = \textcolor{red}{L_0} \textcolor{purple}\oplus F(R_0, K_1)$}

L0=1100 1100 0000 0000 1100 1100 1111 1111F(R0,K1)=0010 0011 0100 1010 1010 1001 1011 1011R1=1110 1111 0100 1010 0110 0101 0100 0100\begin{aligned} \textcolor{red}{L_0} &= 1100\ 1100\ 0000\ 0000\ 1100\ 1100\ 1111\ 1111 \\ F(\textcolor{blue}{R_0}, \textcolor{blue}{K_1}) &= 0010\ \textcolor{red}{0011}\ 0100\ \textcolor{red}{1010}\ 1010\ \textcolor{red}{1001}\ 1011\ \textcolor{red}{1011} \\ \textcolor{red}{R_1} &= 1110\ 1111\ 0100\ 1010\ 0110\ 0101\ 0100\ 0100 \\ \end{aligned}

16 Rounds of Processing - 32-bit Swap#


Final Permutation (FP/IP-1)#

Final Permutation (FP)#

Final Ciphertext Output#

  • Convert to hexadecimal: Convert the final permutation output to hexadecimal to get the ciphertext.

Conclusion#

  • DES exhibits strong avalanche effect − A small change in plaintext results in the very great change in the ciphertext.
  • DES was proved insecure - In January 1999, distributed .net and the Electronic Frontier Foundation collaborated to publicly break a DES key in 22 hours and 15 minutes.
  • DES has been withdrawn as a standard by the National Institute of Standards and Technology
  • This cipher has been superseded by the Advanced Encryption Standard (AES).

Advanced Encryption Standard (AES)#

  • AES is a symmetric encryption algorithm, meaning the same key is used for both encrypting and decrypting data.
  • It was established as a standard by the U.S. National Institute of Standards and Technology (NIST) in 2001 after a competition to replace the older Data Encryption Standard (DES), which was becoming vulnerable to attacks.
  • It is fast, secure, and efficient, making it the go-to choice for protecting sensitive data.

Key Features of AES:
Symmetric Key Algorithm: Uses the same key for encryption and decryption.
Block Cipher: Operates on fixed-size blocks of data (128 bits, or 16 bytes).
Key Length: uses keys of varying lengths (128, 192, or 256 bits).
Rounds of Processing: The encryption process involves multiple rounds of transformations that scramble the data in a way that’s extremely hard to reverse without the key. The number of round in Encryption and Decryption is dependent on the key length

How it works#

  • Key Expansion: The original key (e.g., 128 bits) is expanded into a set of “round keys” used in each step of the encryption. This ensures the key evolves throughout the process, adding complexity.
  • Initial Round: The input data (a 16-byte block) is combined with the first round key using a bitwise XOR operation.
  • Main Rounds: It applies a series of transformations to the data in multiple rounds (10 rounds for 128-bit keys, 12 for 192-bit, 14 for 256-bit). Each round consists of four steps:
    • SubBytes: Each byte in the block is replaced with another byte according to a predefined substitution table (S-box).
    • ShiftRows: The rows of the data block (visualized as a 4x4 grid) are shifted to the left by different amounts.
    • MixColumns: The columns of the grid are mixed using a mathematical operation, further scrambling the data.
    • AddRoundKey: The current round key is XORed with the block, integrating the key into the process.
  • Final Round: The last round skips the MixColumns step but includes SubBytes, ShiftRows, and AddRoundKey to finalize the encryption.

To be continued

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或赞助支持!

赞助
Foundations of Security Week9 Lecture
https://firefly.anka2.top/posts/obu/level5/semester2/fos/week9/lecture/
作者
🐦‍🔥不死鸟Anka
发布于
2026-05-12
许可协议
CC BY-NC-SA 4.0

评论区

Profile Image of the Author
A-n-k-a
Over the Frontier / Into the Front
看这里~
合作翻译官绝赞招募中!
音乐
封面

音乐

暂未播放

0:00 0:00
暂无歌词
分类
标签
站点统计
文章
71
分类
5
标签
19
总字数
682,961
运行时长
0
最后活动
0 天前

文章目录