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

How DES Works (Simple Steps)

  1. Initial Mix-Up: Shuffle the message (permutation)
  2. 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
  3. Final Mix-Up: One last shuffle

Key Features:

S-DES Example Walkthrough

Problem:

Encrypt 00101000 with key 1100011110

Key Making:

  1. P10(key): 11000111100011001111
  2. Split: 00110 | 01111
  3. Shift left 1: 01100 | 11110
  4. P8 → K1: 11101001
  5. Shift left 2: 10001 | 11011
  6. P8 → K2: 10100111

Encryption:

  1. IP: 0010100000100010
  2. Round 1:
    • Right: 001000010100 (expanded)
    • XOR K1: 11111101
    • S-box → 1000
    • P4 → 0010
    • New left: 0011 (original XOR result)
    • Swap: 0010 0011
  3. Round 2 (with K2) → Ciphertext: 10001010

Review Questions

  1. Block vs Stream Cipher?

    • Block: Encrypts chunks (DES)
    • Stream: Encrypts continuously (RC4)
  2. Shannon's Theory?
    Needs both:

    • Confusion (messy key-text)
    • Diffusion (spread effects)
  3. Feistel Cipher?
    Split → Mix right → Swap → Repeat

  4. DES Steps?
    Shuffle → 16 mix rounds → Final shuffle

  5. S-DES Practice:
    For 11110011 with 1010000010:

    • Make keys same way
    • Do 2 encryption rounds

Key Tips: