study_security_l4
"/home/yossef/notes/Su/security/study_security_l4.md"
path: Su/security/study_security_l4.md
- **fileName**: study_security_l4
- **Created on**: 2025-06-02 21:11:28
Block Ciphers & DES Made Simple
What is a Block Cipher?
A secret code machine that works on fixed-size data chunks
(blocks). Example: DES works on 64-bit blocks (8 letters).
Block vs Stream Ciphers
- Block: Encrypts in chunks (like cutting cake into slices)
Ex: DES, AES - Stream: Encrypts bit-by-bit (like pouring syrup)
Ex: RC4
How DES Works (Simple Steps)
- Initial Mix-Up: Shuffle the message (permutation)
- 16 Mixing Rounds:
- Cut message in half (Left & Right)
- Right half gets stretched, mixed with mini-key
- Pass through secret boxes (S-boxes)
- Shuffle again (P-box)
- Left half gets mixed with result
- Swap halves
- Final Mix-Up: One last shuffle
Key Features:
- S-boxes: Secret bit changers
- P-boxes: Bit rearrangers
- Confusion: Makes key-text relationship messy
- Diffusion: Spreads plaintext effects
S-DES Example Walkthrough
Problem:
Encrypt 00101000
with key 1100011110
Key Making:
- P10(key):
1100011110
→0011001111
- Split:
00110
|01111
- Shift left 1:
01100
|11110
- P8 → K1:
11101001
- Shift left 2:
10001
|11011
- P8 → K2:
10100111
Encryption:
- IP:
00101000
→00100010
- Round 1:
- Right:
0010
→00010100
(expanded) - XOR K1:
11111101
- S-box →
1000
- P4 →
0010
- New left:
0011
(original XOR result) - Swap:
0010 0011
- Right:
- Round 2 (with K2) → Ciphertext:
10001010
Review Questions
-
Block vs Stream Cipher?
- Block: Encrypts chunks (DES)
- Stream: Encrypts continuously (RC4)
-
Shannon's Theory?
Needs both:- Confusion (messy key-text)
- Diffusion (spread effects)
-
Feistel Cipher?
Split → Mix right → Swap → Repeat -
DES Steps?
Shuffle → 16 mix rounds → Final shuffle -
S-DES Practice:
For11110011
with1010000010
:- Make keys same way
- Do 2 encryption rounds
Key Tips:
-
DES: Old but important standard
-
S-DES: Simplified learning version
-
XOR: 1+1=0, 0+1=1 (no carry)
-
Always use slide tables for permutations
continue:./study_security_l5.md
before:./study_security_l3.md