Week - 5
Lecture 21:
Advanced Encryption Standard (AES)
Overview
- Modern block cipher replacing DES
- Standardized in 2001 (NIST)
- Based on Rijndael algorithm
Key Features
-
Block size:
-
Key sizes:
- 128-bit → 10 rounds
- 192-bit → 12 rounds
- 256-bit → 14 rounds
AES Variants
| Variant | Key Size | Rounds |
|---|---|---|
| AES-128 | 128 | 10 |
| AES-192 | 192 | 12 |
| AES-256 | 256 | 14 |
Design Goals
-
Resistant to:
- Differential attacks
- Linear attacks
-
Fast and efficient
-
Simple structure
Data Representation (State)
- Plaintext = 128 bits → 16 bytes
Stored as Matrix:
- Each element = 1 byte (8 bits)
AES Structure
Initial Step
- AddRoundKey
Main Rounds (r − 1 times)
Each round consists of:
- SubBytes
- ShiftRows
- MixColumns
- AddRoundKey
Final Round
- SubBytes
- ShiftRows
- AddRoundKey ❌ No MixColumns
Round Flow
Core Operations
1. SubBytes
- Non-linear substitution
- Uses S-box
- Input: 8-bit
- Output: 8-bit
2. ShiftRows
-
Row-wise shifting:
- Row 0 → no shift
- Row 1 → left shift by 1
- Row 2 → left shift by 2
- Row 3 → left shift by 3
3. MixColumns
- Column-wise transformation
- Uses polynomial arithmetic in:
4. AddRoundKey
- XOR with round key:
Key Expansion
-
Generates:
-
Each round uses different key
Important Concepts
-
Works on bytes (8-bit units)
-
Uses:
- Finite field arithmetic
- Polynomial operations
Why AES is Strong
- Non-linearity (S-box)
- Diffusion (MixColumns)
- Multiple rounds
- Large key sizes
Key Takeaways
- AES = substitution + permutation based cipher
- Uses 4 core operations
- Works on 4×4 byte matrix
- Most widely used encryption standard today
Final Conclusion
-
AES is:
- Secure
- Efficient
- Standard for modern encryption
Lecture 22:
Advanced Encryption Standard (AES) - Continued
AES S-Box (Algebraic Construction)
- Not just a lookup table
- Built using finite field ( GF(2^8) )
Steps to Compute S-Box
- Represent byte as polynomial in ( GF(2^8) )
- Compute multiplicative inverse:
- If ( a = 0 ), define inverse as 0
- Apply affine transformation:
- Indices mod 8
- ( c_i ) = constant
Example
Input:
Output:
MixColumns Operation
- Column-wise transformation
- Based on matrix multiplication in ( GF(2^8) )
Transformation
Notes
-
Multiplication done in:
-
Addition = XOR
Key Scheduling (Key Expansion)
Input
- Initial key:
Output
- Round keys:
(each 128-bit)
Word Representation
- Split key into 4 words:
(each 32-bit)
Generating Next Words
Formula
Special Case (every 4th word)
Apply function ( g ):
g Function
Steps
- Rotation
- SubBytes (S-box)
- Add Round Constant
Decryption (Inverse Operations)
| Encryption | Decryption |
|---|---|
| SubBytes | InvSubBytes |
| ShiftRows | InvShiftRows |
| MixColumns | InvMixColumns |
| AddRoundKey | Same (XOR) |
Important Insights
- XOR is its own inverse:
-
AES combines:
- Field arithmetic
- Bitwise operations
Complete Round (Concept)
Key Takeaways
-
S-box:
- Built using algebra (not random)
-
MixColumns:
- Matrix × vector in ( GF(2^8) )
-
Key schedule:
- Expands key into round keys
-
Strong due to:
- Non-linearity + diffusion
Final Conclusion
-
AES internally uses:
-
Combines:
- Algebra
- Bit operations
✔ This structured design makes AES secure and efficient
Lecture 23:
Introduction to Public Key Cryptosystem, Diffie-Hellman Key Exchange
Motivation
-
Two parties (Alice & Bob) communicate over insecure channel
-
Goal:
- Ensure confidentiality
Symmetric Key Problem
Model
- Same key used:
Issues
-
Key Distribution Problem
- How to securely share ( K )?
-
Scalability Problem
- For ( n ) users: keys required
Diffie-Hellman Key Exchange
Purpose
- Establish shared secret key over insecure channel
Setup
- Public:
Example:
Step 1: Secret Selection
-
Alice:
-
Bob:
Step 2: Compute Public Values
Step 3: Exchange
- Alice → Bob: ( A )
- Bob → Alice: ( B )
Step 4: Shared Secret
-
Alice computes:
-
Bob computes:
✔ Same key derived
Security Basis
- Based on Discrete Logarithm Problem
Public Key Cryptosystem
Idea
- Each user has two keys:
- Public Key (Encryption key)
- Private Key (Decryption key)
Communication Flow
-
Bob generates:
- Public key: ( )
- Private key: ( )
-
Bob publishes:
-
Alice encrypts:
-
Bob decrypts:
Key Property
- Given:
❌ It should be computationally infeasible to find:
Advantages over Symmetric
- No need to share secret key
- Scalable
- Suitable for large networks
Examples of PKC
- RSA
- ElGamal
- Knapsack Cryptosystem
Key Takeaways
- Diffie-Hellman → key exchange
- PKC → separate keys for encryption/decryption
- Security → based on hard mathematical problems
Final Conclusion
-
Public key cryptography solves:
- Key distribution problem
- Scalability issues
Lecture 24:
Knapsack Cryptosystem
AKA Subset Sum
Problem Definition
Given:
- Numbers:
- Target sum:
Find binary values such that:
Complexity
-
Total subsets:
-
Brute force → Exponential time (hard problem)
Superincreasing Sequence
Definition
Sequence where:
Property
- Subset sum becomes easy (polynomial time)
- Solve using greedy approach
Greedy Solution Idea
- Start from largest element
- If: → include it
- Reduce:
- Repeat
Knapsack Cryptosystem Idea
Step 1: Private Key (Bob)
-
Choose superincreasing sequence:
-
Choose:
-
Choose:
Step 2: Public Key
Transform:
- Public key:
Step 3: Encryption (Alice)
-
Message bits:
-
Ciphertext:
Step 4: Decryption (Bob)
- Compute:
- Now solve:
✔ Easy because sequence is superincreasing
Key Insight
- Public sequence looks random (hard problem)
- Private sequence is structured (easy problem)
Why It Works
-
Transformation hides structure:
-
Only Bob knows:
- original sequence
Security Idea
-
Based on:
- Hardness of subset sum problem
Weakness
-
Original knapsack cryptosystem:
- Broken (not secure today)
-
Structure can be recovered
Key Takeaways
-
Subset sum:
- Hard in general
- Easy for superincreasing sequence
-
Cryptosystem:
- Uses transformation to hide structure
Final Conclusion
-
Knapsack cryptosystem introduced idea of:
- trapdoor function
✔ Important concept in public key cryptography
Lecture 25:
RSA Cryptosystem
Overview
- Public key cryptosystem by Rivest, Shamir, Adleman
- Based on:
Key Idea
-
Two keys:
- Public key → encryption
- Private key → decryption
Key Generation (Bob)
Step 1: Choose Primes
Step 2: Compute
Step 3: Choose Public Exponent
Step 4: Compute Private Key
i.e.
Keys
-
Public key:
-
Private key:
Encryption (Alice)
Message:
Ciphertext:
Decryption (Bob)
Why It Works
Using:
- Euler’s theorem
Example
Step 1
Step 2
Step 3
Choose:
Step 4
Find:
(because )
Final Keys
-
Public:
-
Private:
Important Notes
1. Large Primes Required
- Small primes → easy to factor
- Security depends on:
2. Prime Testing
-
Algorithms:
- Miller-Rabin
3. Efficient Exponentiation
Compute:
Using:
- Fast exponentiation (square & multiply)
Key Property (Flexibility)
-
RSA supports:
- Encryption
- Digital signatures
Key Takeaways
-
Based on:
- Factorization hardness
-
Uses:
- Modular arithmetic
- Euler’s theorem
-
Requires:
- Large primes
Final Conclusion
- RSA is one of the most important:
✔ Used in:
- HTTPS
- Digital signatures
- Secure communication