Week - 9
Lecture 41:
Universal Hashing
Universal Hashing (Idea)
- Avoid worst-case inputs by randomly choosing hash function at runtime
Definition
A family of hash functions ( ) is universal if:
Why Useful
- Prevents adversarial inputs
- Guarantees low expected collisions
- Works even if input is malicious
Collision Indicator
Define:
Expectation
Expected Collisions for Key ()
Let set size = ()
(where )
Key Result
✔ Small load factor → fewer collisions
Construction of Universal Family
Example form:
-
Parameters:
- chosen randomly
- Each
Size of Family
If there are (r) parameters:
Bad Hash Functions
-
Cause:
-
Count of such “bad” functions:
Probability of Bad Choice
✔ Matches universal condition
Two-Level (Perfect Hashing)
Idea
-
First level:
- Distribute keys into buckets
-
Second level:
- Build separate hash table for each bucket
Property
For bucket with keys:
Guarantee
-
Total space:
-
Expected collisions:
✔ Can achieve perfect hashing (no collisions)
Key Insight
- Randomization removes worst-case
- Universal hashing → expected operations
- Perfect hashing → collision-free lookup
Lecture 42:
Cryptographic Hash Function
Hash Function (Cryptographic Requirements)
- Maps arbitrary input → fixed size output
Required Properties
1. Arbitrary Input Size
- Accept any length message
2. Fixed Output Size
- Output length is constant
3. Pre-image Resistance (One-way)
Given:
Hard to find:
4. Second Pre-image Resistance
Given:
Hard to find:
5. Collision Resistance
Hard to find:
Use in Authentication
Basic Method
-
Alice sends:
-
Bob:
- Computes:
- Compares
❌ No security (attacker can modify both)
With Secret Key (MAC)
-
Shared key:
-
Alice sends:
-
Bob verifies:
✔ Provides authentication
With Encryption
-
Alice sends:
-
Bob:
- Decrypts:
- Verifies
✔ Authentication + confidentiality
With Digital Signature
-
Alice signs:
-
Sends:
-
Bob verifies:
✔ Strong authentication + non-repudiation
Hash Construction (Iterative)
-
Message split into blocks:
-
Initial value:
-
Process:
- Final hash:
Key Insight
- Hash ensures integrity
- MAC → adds authentication
- Signature → adds identity proof
Final Note
-
Secure hash must satisfy:
- One-way
- Collision resistant
- Efficient
✔ Used in all modern cryptographic systems
Lecture 43:
Secure Hash Algorithm (SHA)
Secure Hash Algorithms
SHA Family
- Developed by NIST (1993)
- SHA-1 later replaced older versions
Variants
- SHA-1 → 160-bit
- SHA-256 → 256-bit
- SHA-384 → 384-bit
- SHA-512 → 512-bit
Message Preprocessing (SHA-1)
Step 1: Padding
-
Append:
-
So that length ≡ 448 mod 512
Step 2: Append Length
- Add original length (64-bit)
Step 3: Blocks
- Divide message into:
Initialization
- Initial hash values (IV):
Processing (Per Block)
-
80 rounds
-
Uses:
- Logical functions
- Constants
- Message schedule
Compression
For each block:
Final Hash
Birthday Attack
- Based on probability of collisions
Probability Idea
- Want:
Approximation
Solve for k
Example (Birthday Problem)
-
Total days:
-
Required people:
✔ >50% chance of same birthday
Implication in Hashing
- For n-bit hash:
Example
- SHA-1 (160-bit):
Key Insight
- Collisions easier than brute force
- Due to:
Final Notes
-
SHA-1 → broken (collision attacks exist)
-
Use:
- SHA-256 or higher
✔ Stronger security against collisions
Lecture 44:
Digital Signature Standard (DSS)
Parameters
-
Primes:
-
Generator:
Key Generation
-
Private key:
-
Public key:
Signing
-
Hash message:
-
Choose random:
Compute
Signature
Verification
- Check:
Compute
Compute
Validity
Correctness
Substitute in:
Key Points
-
Uses hash:
-
Random:
-
Security based on:
Important Notes
- Reusing (k) → private key leak
- Requires secure random generation
Final Insight
-
Signature = pair:
-
Verification uses:
- Public key
- Hash
- Modular arithmetic
✔ Standardized digital signature scheme
Lecture 45:
More on Key Exchange Protocol
3-Party Key Exchange (Basic Idea)
-
Parties: Alice, Bob, Charlie
-
Public:
-
Secrets:
Exchange
-
Alice sends:
-
Bob sends:
-
Charlie sends:
Goal
- Shared key:
Problem
-
With normal exponentiation:
- Requires multiple rounds
- Not efficient
Bilinear Pairing Setup
-
Groups:
-
Pairing:
Properties
1. Bilinearity
2. Non-degeneracy
3. Computability
- Efficient to compute
Public Setup
-
Generator:
-
Public:
Private Keys
Exchange (1 Round)
-
Alice sends:
-
Bob sends:
-
Charlie sends:
Key Computation
Alice
Bob
Charlie
Shared Key
✔ Same for all three
Key Insight
-
Pairing enables:
-
Achieves:
- 3-party key agreement
- Single round communication
Notes
-
Used in:
- Identity-based cryptography
- Advanced protocols
-
Still active research area