IF4020 Cryptography: Master Exam Study Guide & Interactive Lab

👨‍🏫 Instructor: Prof. Dr. Ir. Rinaldi Munir, M.T. 📚 Scope: Slides 01 – 21 + Official Midterm Problem Set PDF ⚡ Features: 8 Interactive Calculators • 13 Fully Solved Exam Problems • 25 Flashcards

Slide 01 1. Introduction & Cryptographic Services

Cryptography is the mathematical science and art of safeguarding message security by transforming intelligible information into an unreadable scrambled form.

Formal Terminology & Notation

📌 Kerckhoffs' Principle (1883) & Shannon's Maxim
A cryptographic system's security must not depend on the secrecy of the algorithm ("security through obscurity" is a fragile illusion); it must depend solely on the secrecy of the key ("The enemy knows the system"). Even if the entire algorithm specification is published or analyzed by adversaries, the system must remain mathematically unbreakable as long as the key remains private.

Four Fundamental Cryptographic Services

Security Service Operational Definition Underlying Cryptographic Mechanisms
1. Confidentiality Ensures that information content is kept strictly secret from unauthorized eavesdroppers. Symmetric / Asymmetric Encryption (AES, ChaCha20, RSA).
2. Data Integrity Guarantees that the message has not been altered, inserted, deleted, or tampered with during transmission. Cryptographic Hash Functions (SHA-256, SHA-3), Message Authentication Codes (HMAC).
3. Authentication • Entity Authentication: Verifies the claimed identity of the communicating peer.
• Data Origin Authentication: Confirms that the message genuinely originated from the legitimate sender.
Digital Signatures, Challenge-Response Protocols, X.509 Digital Certificates.
4. Non-repudiation Prevents the sender from falsely denying having generated or transmitted the message. Digital Signatures (asymmetric private signing keys held exclusively by the sender).

Slide 02 2. Cryptographic Mathematics & Information Theory

Euclidean Division Theorem

For any integer a and positive integer modulus m > 0, there exists a unique pair of integers q (quotient) and r (remainder) such that:

Integer Division Theorem a = q × m + r      where 0 ≤ r < m
⚠️ Classical Exam Trap: Negative Modulo Arithmetic
In cryptographic modular arithmetic, the remainder (r) must always be strictly non-negative within the range [0, m - 1]:
• 23 mod 5 = 3 (since 23 = 4 × 5 + 3)
• -41 mod 9 = 4 (since -41 = -5 × 9 + 4, not -5!)
• -145 mod 23 = 16 (since -145 = -7 × 23 + 16, with 16 ∈ [0, 22]).

Modular Congruence & Multiplicative Inverses

a ≡ b (mod m) asserts that m divides (a - b) evenly. The set of residue classes modulo m forms the ring ℤm = {0, 1, 2, …, m - 1}.

The multiplicative inverse a-1 mod m is an integer x ∈ ℤm satisfying the linear congruence:

Modular Multiplicative Inverse a · x ≡ 1 (mod m)
Absolute Condition for Inverse Existence
The modular inverse a-1 mod m exists if and only if gcd(a, m) = 1 (i.e., a and m are strictly coprime / relatively prime). If a and m share any common factor > 1, the inverse never exists!

Bézout's Identity & The Extended Euclidean Algorithm

If gcd(a, m) = 1, Bézout's identity states there exist integers x and y such that:

Bézout's Identity a · x + m · y = gcd(a, m) = 1

Taking this equation modulo m causes the term m · y to vanish, yielding (a · x) mod m ≡ 1. Thus, Bézout coefficient x directly supplies a-1 mod m.

Euler's Totient, Fermat's Little Theorem & Shannon Entropy

Slides 03, 04, 05 3. Classical Ciphers & One-Time Pad

Cipher Family Classification Encryption & Decryption Formulas Key Space & Vulnerabilities
Caesar Cipher Monoalphabetic C ≡ P + k (mod 26)
P ≡ C - k (mod 26)
Only 26 possible keys. Completely broken via single-letter frequency analysis and exhaustive brute force.
Affine Cipher Monoalphabetic C ≡ aP + b (mod 26)
P ≡ a-1(C - b) (mod 26)
Key a must satisfy gcd(a, 26) = 1 (12 choices). Key b ∈ [0, 25] (26 choices). Total key space = 12 × 26 = 312. Vulnerable to frequency analysis.
Standard Vigenère Polyalphabetic Ci ≡ Pi + Ki mod m (mod 26)
Pi ≡ Ci - Ki mod m (mod 26)
Flattens unigram letter frequencies. Displays periodicity with period m. Decomposes into m independent Caesar ciphers via Kasiski & Index of Coincidence tests.
Full Vigenère Polyalphabetic Alphabet rows are randomized permutations rather than simple shifts. Expands the tableau key space, but retains key-length periodicity m.
Autokey Vigenère Polyalphabetic Key begins with a keyword seed, then appends the plaintext itself: K = seed || P. Eliminates repeating keyword periodicity. However, once the short seed is guessed, the subsequent plaintext unravels in a cascade.
Running Key Vigenère Polyalphabetic Key stream is drawn from a long passage of natural text in a book. Non-periodic, but natural language statistics in the key text can be exploited via simultaneous language analysis.
Homophonic Cipher Monoalphabetic Multi-symbol Single plaintext letters map to multiple ciphertext numbers proportional to natural frequencies (e.g. 'A' → {05, 19, 42}). Completely flattens single-letter unigram histograms, but digram and trigram correlations reveal the plaintext structure.
Playfair Cipher Polygraphic (Digram) 5×5 matrix containing 25 letters ('J' merged with 'I'). Operates on letter pairs (digrams). Splits identical consecutive letters with 'X'. Pads odd length with 'X'. Key space 25! ≈ 1.55 × 1025. Broken via digram frequency analysis.
Hill Cipher Polygraphic (Matrix) C ≡ K · P (mod 26)
P ≡ K-1 · C (mod 26)
Key K is an m×m matrix. Invertible iff gcd(det(K), 26) = 1.
Completely broken by Known-Plaintext Attack (KPA): K = C · P⁻¹ mod 26.
Transposition Ciphers Permutation Columnar Transposition, Rail Fence, Route Cipher. Key Invariant: Letter frequency histograms are 100% identical to the plaintext. Solved via anagramming and vowel-consonant digraph reconstruction.
Product Ciphers (Super-encryption) Hybrid Chaining substitution (e.g., Vigenère) followed by transposition (e.g., Columnar). Early implementation of Shannon's dual principles: confusion (substitution) and diffusion (transposition).

Playfair Cipher 5×5 Encryption Rules

  1. If both letters in the digram appear in the same row: replace each with the letter immediately to its right (wrapping cyclically to the start).
  2. If both letters appear in the same column: replace each with the letter immediately below it (wrapping cyclically to the top).
  3. If the letters form a rectangle: replace each with the letter in its own row, but in the column occupied by the other letter.

One-Time Pad (Vernam Cipher, Slide 05)

OTP Bitwise Encryption & Decryption Ci = Pi ⊕ Ki        Pi = Ci ⊕ Ki

Slide 06 4. Cryptanalysis & Attack Models

1. Information Availability Attack Models (Hierarchy of Attacker Access)

Based on Kerckhoffs' principle, the adversary is assumed to possess complete knowledge of the cryptographic algorithm. The security of the cryptosystem relies solely on the secrecy of the key. Attacks are classified by what data the adversary can observe or manipulate:

Power Tier Attack Model Information Available to Adversary Typical Exploitation / Vulnerable Ciphers
1 (Weakest) Ciphertext-Only Attack (COA) Adversary possesses only intercepted ciphertext strings C1, C2, ..., Ck. Caesar (25 brute-force shifts), Affine (frequency matching), Monoalphabetic substitution (letter frequency analysis). Most difficult attack scenario.
2 Known-Plaintext Attack (KPA) Adversary possesses matched pairs of plaintexts and ciphertexts: (P1, C1), (P2, C2), ... Common when file headers (e.g., %PDF-, <html>) or standardized formal salutations (e.g., "Dengan hormat", "Subject:") are predictable. Hill Cipher (recovering matrix key via K = C · P⁻¹ mod 26), LFSR keystreams (Berlekamp-Massey algorithm requires 2n keystream bits to solve all feedback taps).
3 Chosen-Plaintext Attack (CPA) Adversary can select arbitrary plaintexts and feed them into an encryption oracle to obtain corresponding ciphertexts. Modern security standard (IND-CPA). All public-key ciphers (RSA, ElGamal) inherently face CPA because anyone can encrypt arbitrary plaintexts using the public key.
4 Adaptive Chosen-Plaintext Attack (ACPA) Adversary can choose plaintexts iteratively/interactively, tailoring subsequent plaintexts based on analysis of previous ciphertext responses (e.g., iteratively querying an ATM PIN verification module). Differential cryptanalysis of block ciphers, targeted differential power analysis.
5 (Strongest) Chosen-Ciphertext Attack (CCA / CCA2) Adversary can submit arbitrary ciphertexts to a decryption oracle and obtain the resulting plaintexts (except the target challenge ciphertext in CCA2). Textbook unpadded RSA (exploiting multiplicative malleability: c' = c · rᵉ mod n), Bleichenbacher's million-message attack on PKCS#1 v1.5 padding.

2. Computational Security Criteria (Pak Rinaldi Slide 06)

A cryptosystem is defined as computationally secure if it satisfies either of the following two pragmatic real-world conditions:

  1. Economic Barrier: The financial or computational cost required to break the cipher exceeds the intrinsic economic value of the encrypted information.
  2. Temporal Barrier: The total computation time required to break the cipher exceeds the operational lifetime or validity window of the encrypted information (e.g., tactical battlefield orders whose value expires in 2 hours).

3. Classification by Attacker Objective

  1. Total Break (Key-Recovery Attack): The adversary discovers the master secret key K, allowing them to decrypt all past, present, and future communications.
  2. Plaintext-Recovery Attack: The adversary decrypts a specific targeted ciphertext C without learning the general secret key K.
  3. Distinguishing Attack: The adversary can reliably distinguish whether an output string was generated by the cipher or drawn from a uniform random bit generator (probability > 1/2).
  4. Forgery Attack: The adversary crafts a fraudulent ciphertext or signature that is accepted as legitimate by the receiver, without possessing the valid secret key.
  5. Replay Attack: The adversary intercepts a legitimate encrypted message (e.g., an authenticated fund transfer request) and transmits it again unaltered to trick the recipient into repeating the transaction. Defeated using cryptographic nonces, sequence numbers, or timestamps.

4. Classification by Communication Interaction (Passive vs. Active)

Category Adversary Behavior & Mechanisms Security Service Violated Countermeasures
Passive Attacks Adversary monitors transmission without modifying data. Goal is purely eavesdropping.
Methods:
  • Packet Sniffing: Capturing cleartext headers, credentials, or traffic patterns using tools like Wireshark.
  • Wiretapping: Physical tapping of copper telephone/Ethernet lines or optical fiber splitting.
  • Electromagnetic Eavesdropping (TEMPEST): Intercepting RF emissions radiated from monitors, cables, or CPUs (Van Eck phreaking).
  • Acoustic Eavesdropping: Analyzing keystroke acoustic vibrations recorded via laser vibrometry or smartphone microphones.
  • Traffic Analysis: Monitoring transmission volume, frequency, and packet timing to infer sensitive operational activity even when payloads are encrypted.
Confidentiality (Integrity is untouched; extremely difficult to detect in real time). Strong end-to-end encryption (TLS, IPsec) and dummy traffic padding.
Active Attacks Adversary actively intervenes in the communication channel, altering data or system states.
Methods:
  • Masquerade / Spoofing: Impersonating an authorized entity.
  • Message Modification: Altering, reordering, deleting, or injecting data blocks in transit.
  • Replay: Capturing and retransmitting previously valid transmission units.
  • Denial of Service (DoS): Flooding cryptographic servers with bogus requests to exhaust CPU resources.
  • Man-in-the-Middle (MitM): Establishing independent connections between two communicating parties, intercepting and re-encrypting messages on the fly.
Integrity, Authentication, Availability Cryptographic Message Authentication Codes (MAC), digital signatures, mutual TLS authentication, timestamps, nonces.

5. Side-Channel Attacks

Side-channel attacks exploit physical implementation artifacts produced by the cryptographic hardware or software during execution, bypassing the mathematical complexity of the underlying algorithm:

6. Classical Statistical Cryptanalysis Techniques

Slide 07 5. Modern Stream Ciphers (LFSR, A5/1, RC4)

Linear Feedback Shift Registers (LFSR)

Consists of an n-bit shift register where the incoming feedback bit is a linear XOR combination of specified register taps:

LFSR Linear Feedback Bit snew = ⊕i=1n (ci · sn-i)

A5/1 Stream Cipher (GSM Cellular Standard)

RC4 (Ronald Rivest, 1987)

A byte-oriented stream cipher with an internal state permutation array S[0…255] of 256 bytes:

// 1. Key Scheduling Algorithm (KSA)
for i = 0 to 255: S[i] = i
j = 0
for i = 0 to 255:
    j = (j + S[i] + key[i mod key_len]) mod 256
    swap(S[i], S[j])

// 2. Pseudo-Random Generation Algorithm (PRGA)
i = (i + 1) mod 256
j = (j + S[i]) mod 256
swap(S[i], S[j])
t = (S[i] + S[j]) mod 256
keystream_byte = S[t]

Design Weakness & Attack: The initial keystream bytes exhibit measurable statistical correlation with the secret key (exploited by Fluhrer, Mantin, and Shamir in the FMS attack against WEP Wi-Fi). Industry standard mitigation: discard the first 1024 or 3072 bytes of keystream (RC4-drop).

Slide 08 6. Block Cipher Principles & Modes of Operation

Shannon's Principles: Confusion, Diffusion & Avalanche Effect

Li-1 Ri-1 F(R, Ki) Subkey Ki ↓ ⊕ Li = Ri-1 Ri = Li-1 ⊕ F
Feistel Network Round Architecture (One Full Round with Half Swapping)

Standard Padding Schemes (PKCS#5 & PKCS#7)

Block ciphers require plaintexts to be exact multiples of the block size b (DES: 8 bytes, AES: 16 bytes). If a message falls short by k bytes, append k bytes where each byte has value k:

Comparative Matrix of 5 Standard Block Cipher Modes of Operation

Mode of Operation Mathematical Formulation Parallel Enc / Dec Padding Required? Transmission Error Propagation Key Advantage / Critical Vulnerability
ECB (Electronic Codebook) Ci = EK(Pi)
Pi = DK(Ci)
Yes / Yes Yes 1-bit error in Ci corrupts only block Pi. Other blocks unaffected. Leaks structural plaintext patterns (ECB Penguin vulnerability). Strictly forbidden for multi-block data.
CBC (Cipher Block Chaining) Ci = EK(Pi ⊕ Ci-1)
Pi = DK(Ci) ⊕ Ci-1
(C0 = IV)
No / Yes Yes 1-bit error in Ci completely corrupts Pi, and flips the exact same bit in Pi+1. Subsequent blocks recover (self-synchronizing). Classic industry standard. Requires a cryptographically random, unpredictable Initialization Vector (IV).
CFB (Cipher Feedback) Ci = Pi ⊕ EK(Ci-1)
Pi = Ci ⊕ EK(Ci-1)
No / Yes No 1-bit error in Ci corrupts that bit in Pi and scrambles units while passing through the shift register. Emulates a self-synchronizing stream cipher. Decryption requires only the encryption function EK!
OFB (Output Feedback) Oi = EK(Oi-1), O0 = IV
Ci = Pi ⊕ Oi
Pi = Ci ⊕ Oi
Precomputed / Precomputed No Zero error propagation: A 1-bit error in Ci flips only the corresponding bit in Pi. Pure synchronous stream mode. Keystream can be precomputed before data arrival (near-zero latency). Never reuse an IV!
CTR (Counter Mode) Ci = Pi ⊕ EK(Nonce ∥ i)
Pi = Ci ⊕ EK(Nonce ∥ i)
Yes / Yes No Zero error propagation: A 1-bit error in Ci flips only the corresponding bit in Pi. Modern gold standard. Maximum throughput, full multi-core parallelization, random access to arbitrary blocks. Reusable nonce is catastrophic!

Slides 09, 10, 11 7. Standard Block Cipher Implementations

DES (Data Encryption Standard, Slide 09)

AES (Advanced Encryption Standard / Rijndael, Slide 10)

State 4×4 Bytes SubBytes Confusion ShiftRows Diffusion (Row) MixColumns Diffusion (Col) AddRound Key ⊕ Subkey
Four Standard AES Round Transformations (MixColumns is omitted in the final round Nr)

Other Notable Block Ciphers & AES Finalists (Slide 11)

Cipher Designers / Year Architecture & Parameters Distinctive Mechanics & Security Highlights
GOST 28147-89 (Magma) Soviet Standard (1989) Feistel Network
Block: 64 bits
Key: 256 bits
Rounds: 32
Round subkey addition modulo 232 → eight 4×4 S-boxes (nibble substitution) → circular 11-bit left shift (<<< 11). Key schedule cycles through eight 32-bit words K0..K7 three times forward (rounds 1–24) and once in reverse (rounds 25–32). Immense 256-bit key space provides extreme resistance to brute force.
RC5 Ronald Rivest (1994) Parameterized Feistel
RC5-w/r/b
Word: w ∈ {16, 32, 64}
Rounds: r ∈ [0, 255]
Key: b bytes
Pioneered data-dependent rotations (<<<), where shift amounts are dynamically determined by low bits of register data. Key schedule expands b key bytes into 2r+2 subwords using mathematical constants Pw (odd integer of e - 2) and Qw (odd integer of φ - 1). Fast software execution with variable word width.
RC6 Rivest, Robshaw, Sidney, Yin (1998) AES Finalist
Block: 128 bits
Key: 128, 192, 256 bits
Rounds: 20
Evolution of RC5 operating over four 32-bit registers (A, B, C, D). Introduces quadratic transformation f(x) = x(2x + 1) mod 2w before data-dependent rotations to ensure rapid avalanche effect and defeat linear cryptanalysis.
Blowfish Bruce Schneier (1993) Feistel Network
Block: 64 bits
Key: 32 – 448 bits (variable)
Rounds: 16
Employs four key-dependent S-boxes (each 256 × 32 bits) and an 18-entry P-array, all initialized using hexadecimal expansion digits of π (nothing-up-my-sleeve numbers) and transformed via iterative self-encryption. Zero known effective attacks; extremely fast on 32-bit CPUs.
IDEA Lai & Massey (1990) Block: 64 bits
Key: 128 bits
Rounds: 8.5
Combines three algebraically incompatible group operations: bitwise XOR (⊕), addition mod 216 (+), and multiplication mod 216 + 1 (⊙). Eliminates S-boxes completely while achieving high non-linearity. Used in early PGP 2.0.

The AES Selection Competition (NIST 1997–2000 Finalists)

NIST evaluated five finalists to replace DES under strict criteria: mathematical security, computational efficiency in software and hardware, memory footprint, and algorithmic simplicity:

Slides 13, 14, 15 8. Public-Key Cryptography: RSA, Diffie-Hellman & ElGamal

RSA Cryptosystem (Rivest, Shamir, Adleman 1977, Slide 13)

Diffie-Hellman Key Exchange (1976, Slide 15)

ElGamal Cryptosystem (Taher ElGamal 1985, Slide 14)

Slide 16 9. Knapsack Cryptosystem (Merkle-Hellman)

The General Subset-Sum Problem

Given integer weights W = {w1, w2, ..., wn} and total capacity C, find a binary vector b = (b1, ..., bn) ∈ {0, 1}n such that:

Subset-Sum Equation C = ∑i=1n bi · wi

For arbitrary weight sequences, this problem is proven to be NP-complete with no known polynomial-time solution.

Superincreasing Knapsack (The Easy Private Key)

A sequence S is superincreasing if each element is strictly greater than the sum of all preceding elements:

Superincreasing Property si > ∑j=1i-1 sj      (for all i = 2, …, n)

Subset-sum on a superincreasing sequence is solved in linear time O(n) using a Greedy algorithm from the largest weight (sn) down to the smallest (s1): if C ≥ si, set bi = 1 and decrement C = C - si; otherwise set bi = 0.

Merkle-Hellman Trapdoor Construction

Slides 17, 18 10. Abstract Algebra & Elliptic Curve Cryptography (ECC)

Abstract Algebraic Structures for Cryptography (Slide 17)

Weierstrass Elliptic Curves (Slide 18)

Standard Weierstrass form over field GF(p) (where prime p > 3):

Weierstrass Elliptic Curve y2 = x3 + ax + b      (mod p)
x y P Q -R R = P + Q
Elliptic Curve Point Addition Geometry: Secant line intersects at -R, reflected across the x-axis to R = P + Q

Point Addition & Doubling Formulas over GF(p)

Given points P(xP, yP) and Q(xQ, yQ) on curve y² ≡ x³ + ax + b (mod p):

1. Slope Calculation m (mod p) If P ≠ Q (Point Addition):    m ≡ (yQ - yP) · (xQ - xP)-1 (mod p)

If P = Q (Point Doubling 2P):    m ≡ (3xP2 + a) · (2yP)-1 (mod p)
2. Resulting Point Coordinates R(xR, yR) = P + Q xR ≡ (m2 - xP - xQ) (mod p)
yR ≡ [m(xP - xR) - yP] (mod p)

ECDLP, Key Efficiency & Protocols

Slides 19, 20 11. Steganography, Steganalysis & NoStega

Comparative Triad: Cryptography vs. Steganography vs. Digital Watermarking

Dimension Cryptography Steganography Digital Watermarking
Primary Goal Obscure message content to render it unintelligible. Conceal the very existence of communication from detection. Assert copyright ownership and verify carrier media integrity.
Carrier (Cover) Status Irrelevant / no cover medium. Disposable envelope discarded after secret extraction. The primary high-value asset (copyrighted artwork, medical scans).
Visibility Ciphertext is visibly scrambled and suspicious to eavesdroppers. Strictly imperceptible; raises zero suspicion. Can be visibly noticeable or imperceptible.

Simmons' Prisoners Problem (1983)

Alice and Bob are incarcerated in separate prison cells attempting to coordinate an escape plan. All communications between them are monitored by a warden named Wendy. If Wendy detects encrypted text or any suspicious covert signal, she cuts off communication immediately and places them in solitary confinement. Alice and Bob must employ steganography to conceal their escape plans inside mundane, innocent letters without triggering Wendy's suspicion.

Spatial Steganography: LSB & BPCS (Slide 19)

Bit-Plane 7 (MSB) Bit-Plane 0 (LSB) • Plane 7 (MSB): Structural Visual Contours High human visual sensitivity (α low) • Plane 0 (LSB): High-Frequency Random Noise Noisy regions (α ≥ α₀) embedded via BPCS
8-Bit Image Slicing into 8 Independent Binary Bit-Planes in BPCS Steganography

Steganalysis & NoStega (Slide 20)

Slide 21 12. Digital Watermarking

Digital Watermarking Taxonomy (Slide 21)

  1. By Human Visual Perception:
    • Visible Watermark: Visually apparent to the human eye without computational extraction (e.g., TV network logos in broadcast corners, transparent "PREVIEW" overlays on stock photography).
    • Invisible Watermark: Perceptually imperceptible; embedded within media bit structures.
  2. By Robustness Level:
    • Robust Watermark: Survives severe signal processing attacks including lossy compression (JPEG), cropping, scaling, filtering, and rotation. Mandatory for copyright protection and proof of ownership.
    • Fragile Watermark: Deliberately sensitive; destroyed or altered if the media is modified by as little as 1 pixel. Used for tamper detection and data integrity verification in medical imaging (X-rays) and court evidence.
    • Semi-fragile Watermark: Tolerates benign compression, but degrades under malicious semantic manipulations (e.g., altering license plate numbers in surveillance footage).
  3. By Extraction Input Requirements:
    • Blind (Public) Watermarking: Extraction does not require the original un-watermarked media. Essential for decentralized internet verification.
    • Non-blind (Private) Watermarking: Extraction requires the original un-watermarked media as a reference baseline. Highly resilient in legal copyright disputes.

Fragile vs. Robust Watermarking Mechanics

Category Representative Algorithm Domain & Embedding Strategy Attack Response & Typical Use Case
Fragile Watermarking Wong's Algorithm (1997) Spatial Domain (LSB): The watermark logo is resized to match the host image dimensions and embedded directly into the LSBs across all pixels. Tamper Localization: Any manipulation (deletion, insertion, localized editing) destroys the embedded LSB watermark in the modified blocks, revealing precisely where and how the image was altered. Used for forensic court evidence and medical scans.
Robust Watermarking Wang's Algorithm (1998) / DCT-based Frequency Domain (DCT): Host image is partitioned into 8×8 blocks, transformed via Discrete Cosine Transform (DCT). Watermark bits modulate the low-to-mid frequency DCT coefficients. High Survivability: High-frequency coefficients are wiped out by JPEG compression, but low-to-mid frequencies survive lossy compression, cropping, resizing, and brightness adjustments. Used for copyright proof and piracy tracing.

Primary Application Domains (Slide 21)

Real-World Case Study: Video Forensic Watermarking & DRM in Netflix

Modern streaming services like Netflix deploy a multi-layered content protection architecture combining DRM and invisible forensic watermarking:

Interactive Lab 13. Interactive Cryptography Lab & Real-Time Solvers 8 Real-Time Tools

Test concepts and run live cryptographic calculations directly in your browser. Click any (Example) preset link to auto-load realistic parameters matching Pak Rinaldi's exam questions.

➗ Modular Inverse & Extended Euclidean
Compute GCD(a, m), Bézout identity coefficients, and multiplicative inverse a⁻¹ mod m. (Example 1: 7⁻¹ mod 26) (Example 2: 19⁻¹ mod 84)
⚡ Fast Modular Exponentiation
Compute bᵉ mod m via step-by-step Square-and-Multiply. (Example 1: 5⁷ mod 187) (Example 2: 7⁵⁶⁰ mod 561)
🔤 Affine Cipher Tool
Validate gcd(a, 26)=1, calculate a⁻¹, and encrypt/decrypt text. (Exam Example)
🧮 Hill Cipher 2×2 Inverter
Compute determinant mod 26, check invertibility, find K⁻¹ mod 26, and process digrams. (Example 1) (Example 2)
📊 Index of Coincidence (IC) & Friedman
Analyze statistical letter distribution, calculate IC, and estimate Vigenère key length m. (Load Sample Ciphertext)
🔑 RSA Keygen, Encrypt & Decrypt
Compute n, φ(n), find private exponent d = e⁻¹ mod φ(n), and test message. (Exam Example: p=11, q=17)
🎒 Merkle-Hellman Knapsack Tool
Verify superincreasing sequence, disguise public key pᵢ = sᵢ·w mod m, encrypt, and greedy decode. (Exam Example: S=[2,3,7,14,30])
📐 ECC Point Arithmetic (GF(p))
Evaluate Point Doubling 2P or Point Addition P + Q on curve y² = x³ + ax + b (mod p). (Exam Example: 2P on GF(11))

Exam Problem Bank 14. Official Midterm Practice Set (Pak Rinaldi Munir) + Complete Solutions 13 Fully Solved Problems

This section incorporates the complete set of official practice problems provided by Prof. Rinaldi Munir (STEI ITB) for the IF4020 Cryptography midterm exam, fully translated and augmented with step-by-step mathematical proofs.

Problem 1: 2×4 Encrypted Image Shannon Entropy Calculation (Official Practice Problem 1)

Problem Statement:
A 2×4 pixel image is encrypted, resulting in the following pixel intensity values (ranging from 0 to 3):
1   0   0   3
2   3   1   3

Calculate the Shannon entropy of this encrypted image!


Step-by-Step Solution:
1. Total Pixels: N = 2 × 4 = 8 pixels.
2. Alphabet of Symbols: Intensities ∈ {0, 1, 2, 3} (n = 4 possible symbols).
3. Empirical Probabilities:
- Count of '0': 2 → p(0) = 2/8 = 0.25
- Count of '1': 2 → p(1) = 2/8 = 0.25
- Count of '2': 1 → p(2) = 1/8 = 0.125
- Count of '3': 3 → p(3) = 3/8 = 0.375
(Sum: 0.25 + 0.25 + 0.125 + 0.375 = 1.0 ✓)

4. Shannon Entropy Formula:
H(X) = - ∑ pi log2(pi)
- p(0) log2(p(0)) = 0.25 × (-2) = -0.5
- p(1) log2(p(1)) = 0.25 × (-2) = -0.5
- p(2) log2(p(2)) = 0.125 × (-3) = -0.375
- p(3) log2(p(3)) = 0.375 × log2(0.375) ≈ 0.375 × (-1.415037) ≈ -0.530639

5. Summing Terms:
H(X) = - [-0.5 - 0.5 - 0.375 - 0.530639] = - [-1.905639] ≈ 1.906 bits.
Interpretation: The theoretical maximum entropy for 4 symbols is log2(4) = 2.0 bits. The encrypted image entropy of 1.906 bits is very close to maximum uncertainty, indicating high statistical randomness.

Problem 2: Hexadecimal Vigenère Cipher Modulo 16 (Official Practice Problem 2)

Problem Statement:
A Vigenère Cipher is modified such that all plaintext, ciphertext, and key characters are hexadecimal digits (0..9, A..F).
(a) If Pi is the i-th plaintext digit, Ci is the i-th ciphertext digit, and Ki is the i-th key digit, state the general encryption and decryption equations:
E(Pi, Ki) = Ci = __________________
D(Ci, Ki) = Pi = __________________
(b) For plaintext P = 3AE60A3 and repeating key K = 17E, determine the resulting ciphertext C.


Step-by-Step Solution:
(a) General Modular Equations (Modulo 16):
- Encryption: Ci = (Pi + Ki) mod 16
- Decryption: Pi = (Ci - Ki) mod 16

(b) Encryption of P = 3AE60A3 with K = 17E:
Align the repeating key stream:
Plaintext: 3   A   E   6   0   A   3
Keystream: 1   7   E   1   7   E   1

Convert hex characters to decimal values (A=10, B=11, C=12, D=13, E=14, F=15):
1. Digit 1: (3 + 1) mod 16 = 4 → 4
2. Digit 2: (A + 7) mod 16 = (10 + 7) mod 16 = 17 mod 16 = 1 → 1
3. Digit 3: (E + E) mod 16 = (14 + 14) mod 16 = 28 mod 16 = 12 → C
4. Digit 4: (6 + 1) mod 16 = 7 mod 16 = 7 → 7
5. Digit 5: (0 + 7) mod 16 = 7 mod 16 = 7 → 7
6. Digit 6: (A + E) mod 16 = (10 + 14) mod 16 = 24 mod 16 = 8 → 8
7. Digit 7: (3 + 1) mod 16 = 4 mod 16 = 4 → 4

Final Ciphertext: C = 41C7784.

Problem 3: Super-Encryption: Columnar Transposition + Playfair Cipher (Official Practice Problem 3)

Problem Statement:
A 35-character secret message (in Indonesian) is encrypted using a Product Cipher (Super-encryption):
1. The message is first encrypted using a Columnar Transposition cipher with column size (key) = 7.
2. The resulting intermediate ciphertext is then encrypted using a Playfair Cipher with the key phrase: "SAMUDERA PASIFIK YANG LUAS BANGET" (spaces excluded).
The final intercepted ciphertext is:
MYRSSYYIGKDSMSMRMYRGAIOADKRUGURUIMUM
Decrypt this ciphertext to recover the original plaintext message!


Step-by-Step Solution:
Phase 1: Inverting the Playfair Cipher
Construct the 5×5 Playfair grid from the key phrase (drop duplicate letters; merge J with I):
Unique letters: S - A - M - U - D - E - R - P - I - F - K - Y - N - G - L - B - T - C - H - O - Q - V - W - X - Z.
S   A   M   U   D
E   R   P   I   F
K   Y   N   G   L
B   T   C   H   O
Q   V   W   X   Z


Split ciphertext into 18 digrams and decrypt each using reverse Playfair rules:
MY RS SY YI GK DS MS MR MY RG AI OA DK RU GU RU IM UM
- MY → AN • RS → EA • SY → AK • YI → GR • GK → NL
- DS → UD • MS → AD • MR → AP • MY → AN • RG → IY
- AI → UR • OA → TD • DK → SL • RU → IA • GU → IX
- RU → IA • IM → PU • UM → MA
Decrypted intermediate text: AN EA AK GR NL UD AD AP AN IY UR TD SL IA IX IA PU MA.
Notice digram IX IA: 'X' was inserted as a padding letter to separate identical letters; removing 'X' restores original 35 characters: ANEAAKGRNLUDADAPAN IYURTDSLIAIAPUMA.

Phase 2: Inverting the Columnar Transposition
Total length = 35 characters. Column count (key) = 7. Thus, row count = 35 / 7 = 5.
During encryption, the message was written into 5 columns and read by columns. To invert, write the 35 letters into a 7×5 grid:
A   N   E   A   A
K   G   R   N   L
U   D   A   D   A
P   A   N   I   Y
U   R   T   D   S
L   I   A   I   I
A   P   U   M   A

Read the columns from top to bottom (Col 1 to 5):
Col 1: A K U P U L A → AKUPULA
Col 2: N G D A R I P → NG DARI P
Col 3: E R A N T A U → ERANTAU
Col 4: A N D I D I M → AN DI DI M
Col 5: A L A Y S I A → ALAYSIA

👉 Recovered Plaintext: "AKU PULANG DARI PERANTAUAN DI MALAYSIA"
(Translation: "I am returning home from working abroad in Malaysia").

Problem 4: RSA Decryption via Factorization (Official Practice Problem 4)

Problem Statement:
An RSA public key is given as (e, n) = (5, 221). An adversary intercepts the ciphertext c = 153.
Decrypt this ciphertext to recover the original plaintext message m.


Step-by-Step Solution:
1. Factor the Modulus n:
We factor n = 221 into primes: 221 = 17 × 13.
Thus, p = 17 and q = 13.

2. Compute Euler's Totient φ(n):
φ(n) = (p - 1)(q - 1) = (17 - 1)(13 - 1) = 16 × 12 = 192.

3. Find Private Key Exponent d:
We solve e · d ≡ 1 (mod φ(n)) &implies; 5d ≡ 1 (mod 192).
Using the linear Diophantine form: d = (1 + 192k) / 5.
- For k = 1: (1 + 192) / 5 = 193 / 5 (not integer)
- For k = 2: (1 + 384) / 5 = 385 / 5 = 77.
Thus, private exponent d = 77.

4. Decrypt Ciphertext c = 153:
m ≡ cd (mod n) &implies; m ≡ 15377 (mod 221).
Using modular exponentiation by repeated squaring:
- 153 mod 221 = -68 mod 221
- 1532 = 23409 = 105 × 221 + 204 ≡ -17 mod 221
- 1534 ≡ (-17)2 = 289 = 221 + 68 ≡ 68 mod 221
Evaluating 15377 mod 221 yields: m = 17.

👉 Original Plaintext: m = 17.

Problem 5: Diffie-Hellman + Caesar Super-Encryption (Official Practice Problem 5)

Problem Statement:
(a) Alice and Bob agree to share a symmetric key using Diffie-Hellman with public parameters g = 17 and p = 37. Alice selects private key a = 7, and Bob selects private key b = 9. Determine the shared encryption key K established by Alice and Bob.
(b) If this shared key is used as the shift key for a classical Caesar Cipher, find the ciphertext produced for plaintext: "ADAAPADENGANMU".


Step-by-Step Solution:
(a) Diffie-Hellman Key Computation:
1. Alice computes her public key: A = ga mod p = 177 mod 37.
172 = 289 = 7 × 37 + 30 ≡ -7 mod 37.
174 ≡ (-7)2 = 49 ≡ 12 mod 37.
177 = 174 × 172 × 17 ≡ 12 × (-7) × 17 = -84 × 17 ≡ (-10) × 17 = -170 = -5 × 37 + 15 ≡ 15 (mod 37).
Alice sends A = 15 to Bob.

2. Bob computes his public key: B = gb mod p = 179 mod 37.
178 ≡ 122 = 144 = 3 × 37 + 33 ≡ -4 mod 37.
179 = 178 × 17 ≡ (-4) × 17 = -68 = -2 × 37 + 6 ≡ 6 (mod 37).
Bob sends B = 6 to Alice.

3. Shared secret computation:
- Alice computes: K = Ba mod p = 67 mod 37 = 279936 mod 37 = 31.
- Bob computes: K = Ab mod p = 159 mod 37 = 31.
👉 Shared symmetric key: K = 31.

(b) Caesar Encryption with Shift K = 31:
In alphabet arithmetic (modulo 26): k = 31 mod 26 = 5.
Each letter shifts by +5 positions (A → F, D → I, P → U, etc.):
Plaintext: A   D   A   A   P   A   D   E   N   G   A   N   M   U
Shift +5: F   I   F   F   U   F   I   J   S   L   F   S   R   Z

👉 Ciphertext: "FIFFUFIJSLFSRZ".

Problem 6: Merkle-Hellman Knapsack Cryptosystem (Official Practice Problem 6)

Problem Statement:
An 18-bit binary message '110011 010101 001001' is encrypted using the Merkle-Hellman Knapsack cryptosystem.
The private superincreasing sequence is S = {3, 5, 15, 25, 54, 110}, with parameters multiplier w = 10 (labeled n in PDF) and modulus m = 239.
(a) Derive the public key sequence.
(b) Calculate the ciphertext resulting from the encryption of the 18-bit message.
(c) Compute the modular inverse of multiplier 10 mod 239.
(d) Decrypt the ciphertext step-by-step to recover the original binary plaintext.


Step-by-Step Solution:
(a) Public Key Derivation (pi = (si · 10) mod 239):
- p1 = (3 × 10) mod 239 = 30
- p2 = (5 × 10) mod 239 = 50
- p3 = (15 × 10) mod 239 = 150
- p4 = (25 × 10) mod 239 = 250 mod 239 = 11
- p5 = (54 × 10) mod 239 = 540 mod 239 = 62
- p6 = (110 × 10) mod 239 = 1100 mod 239 = 144
👉 Public Key: P = {30, 50, 150, 11, 62, 144}.

(b) Encryption of 18-Bit Message (3 blocks of 6 bits):
- Block 1 (110011): 1(30) + 1(50) + 0(150) + 0(11) + 1(62) + 1(144) = 286
- Block 2 (010101): 0(30) + 1(50) + 0(150) + 1(11) + 0(62) + 1(144) = 205
- Block 3 (001001): 0(30) + 0(50) + 1(150) + 0(11) + 0(62) + 1(144) = 294
👉 Resulting Ciphertext: C = (286, 205, 294).

(c) Multiplier Modular Inverse:
We seek 10⁻¹ mod 239. Since 240 = 239 + 1, we observe: 10 × 24 = 240 ≡ 1 (mod 239).
👉 10⁻¹ mod 239 = 24.

(d) Decryption via Greedy Algorithm:
Transform each ciphertext element: C' = (C × 24) mod 239:
- Block 1: C' = (286 × 24) mod 239 = 6864 mod 239 = 172
Greedy match against {3, 5, 15, 25, 54, 110}:
172 ≥ 110 → 1 (rem 62); 62 ≥ 54 → 1 (rem 8); 8 < 25 → 0; 8 < 15 → 0; 8 ≥ 5 → 1 (rem 3); 3 ≥ 3 → 1 → 110011.
- Block 2: C' = (205 × 24) mod 239 = 4920 mod 239 = 140
140 ≥ 110 → 1 (rem 30); 30 < 54 → 0; 30 ≥ 25 → 1 (rem 5); 5 < 15 → 0; 5 ≥ 5 → 1 (rem 0); 0 < 3 → 0 → 010101.
- Block 3: C' = (294 × 24) mod 239 = 7056 mod 239 = 125
125 ≥ 110 → 1 (rem 15); 15 < 54 → 0; 15 < 25 → 0; 15 ≥ 15 → 1 (rem 0); 0 < 5 → 0; 0 < 3 → 0 → 001001.

👉 Recovered Plaintext: 110011 010101 001001 ✓ (100% matched!).

Problem 7: Affine Cipher Cryptanalysis via English Letter Frequencies (Official Practice Problem 7)

Problem Statement:
Break an Affine Cipher given the following frequency analysis hints from an English ciphertext:
- The most frequent letter in the ciphertext is 'V'.
- The least frequent letter in the ciphertext is 'Y'.
Derive the encryption and decryption formulas, then decrypt the frequent English trigram ciphertext: "NAG".
(Character encoding: A = 0, B = 1, ..., Z = 25).


Step-by-Step Solution:
1. Frequency Mapping to English Alphabet:
- Most frequent letter in English is 'E' (value 4) → maps to 'V' (value 21).
- Least frequent letter in English is 'Z' (value 25) → maps to 'Y' (value 24).

2. Setup System of Modular Congruences (C ≡ mP + b mod 26):
(1) 25m + b ≡ 24 (mod 26)
(2) 4m + b ≡ 21 (mod 26)

3. Subtract Equation (2) from Equation (1):
(25m - 4m) ≡ (24 - 21) (mod 26) &implies; 21m ≡ 3 (mod 26).
Find 21⁻¹ mod 26: 21 × 5 = 105 = 4 × 26 + 1 ≡ 1, so 21⁻¹ ≡ 5.
m ≡ 3 × 5 = 15 (mod 26).

4. Solve for Key b:
Substitute m = 15 into (2): 4(15) + b ≡ 21 (mod 26) &implies; 60 + b ≡ 21 (mod 26).
60 mod 26 = 8 → 8 + b ≡ 21 &implies; b = 21 - 8 = 13.
Encryption Equation: C ≡ 15P + 13 (mod 26).

5. Derive Decryption Formula:
Find 15⁻¹ mod 26: 15 × 7 = 105 ≡ 1 (mod 26), so 15⁻¹ ≡ 7.
P ≡ 7(C - 13) (mod 26).

6. Decrypt Trigram "NAG":
- 'N' (C = 13): P ≡ 7(13 - 13) = 0 → Letter 'A'
- 'A' (C = 0): P ≡ 7(0 - 13) = -91 mod 26 = 13 → Letter 'N'
- 'G' (C = 6): P ≡ 7(6 - 13) = -49 mod 26 = 3 → Letter 'D'

👉 Plaintext Trigram: "AND" (the most common English trigram!).

Problem 8: Diffie-Hellman with Active Man-in-the-Middle Attack (Official Practice Problem 8)

Problem Statement:
Alice and Bob agree on Diffie-Hellman public parameters g = 10 and p = 71. Alice picks private key a = 10, and Bob picks b = 12.
(a) Case 1 (Benign): No attack occurs. Calculate the shared symmetric encryption key K established by Alice and Bob.
(b) Case 2 (Active Attack): Mallory intercepts the communication and executes an active Man-in-the-Middle (MitM) attack using her own private exponent m = 15. Determine the separate session keys K1 (established with Alice) and K2 (established with Bob) recovered by Mallory.


Step-by-Step Solution:
(a) Case 1 (Legitimate Exchange):
- Alice's public key: A = 1010 mod 71 = 30
- Bob's public key: B = 1012 mod 71 = 18
- Alice receives B and computes: K = Ba mod 71 = 1810 mod 71 = 37
- Bob receives A and computes: K = Ab mod 71 = 3012 mod 71 = 37
👉 Shared Secret Key: K = 37.

(b) Case 2 (Mallory's Active Interception):
Mallory intercepts transmission and injects her own public key: M = gm mod p = 1015 mod 71 = 37.
- Alice receives M (believing it came from Bob) and computes:
K1 = Ma mod 71 = 3710 mod 71 = 30.
- Bob receives M (believing it came from Alice) and computes:
K2 = Mb mod 71 = 3712 mod 71 = 32.

Mallory computes both shared keys using her private exponent m = 15:
- Key with Alice: K1 = Am mod 71 = 3015 mod 71 = 30.
- Key with Bob: K2 = Bm mod 71 = 1815 mod 71 = 32.

👉 Resulting compromised session keys:
- K1 = 30 (between Alice and Mallory)
- K2 = 32 (between Bob and Mallory).

Problem 9: 3-Bit Block Cipher CBC Mode Encryption (Official Practice Problem 9)

Problem Statement:
Consider a toy block cipher where block size = key size = 3 bits. Each 3-bit block is encrypted under key k using the mapping:
Ek(b1b2b3) = (b2b1b3) ⊕ k
(i.e., swap the first two bits, then bitwise XOR with key k).
Determine the ciphertext resulting from encrypting plaintext m = 100100100 using key k = 110 in CBC mode with Initialization Vector IV = 111.


Step-by-Step Solution:
Split plaintext into three 3-bit blocks: P1 = 100, P2 = 100, P3 = 100.
CBC Encryption Rule: Ci = Ek(Pi ⊕ Ci-1), where C0 = IV = 111.

Block 1:
- XOR with IV: P1 ⊕ C0 = 100 ⊕ 111 = 011.
- Swap first two bits: 011 → 101.
- XOR with key k: 101 ⊕ 110 = 011.
→ C1 = 011.

Block 2:
- XOR with C1: P2 ⊕ C1 = 100 ⊕ 011 = 111.
- Swap first two bits: 111 → 111.
- XOR with key k: 111 ⊕ 110 = 001.
→ C2 = 001.

Block 3:
- XOR with C2: P3 ⊕ C2 = 100 ⊕ 001 = 101.
- Swap first two bits: 101 → 011.
- XOR with key k: 011 ⊕ 110 = 101.
→ C3 = 101.

👉 Final Ciphertext: C = 011 001 101.

Problem 10: 4-Bit LFSR Keystream Generation with Non-Primitive Polynomial (Official Practice Problem 10)

Problem Statement:
A 4-bit LFSR is defined with feedback function: b4 = b1 ⊕ b2 ⊕ b3 ⊕ b4.
If the register is initialized with seed '1010' (where b1 is the output bit), generate the resulting keystream for the first 15 bits.


Step-by-Step Solution:
Register layout: [b4, b3, b2, b1]. At each step, output bit is b1, and new feedback bit bnew = b1 ⊕ b2 ⊕ b3 ⊕ b4 enters at b4 as the register shifts right:

- Step 0: State: 1010 → Output b1 = 0. Feedback: 1⊕0⊕1⊕0 = 0.
- Step 1: State: 0101 → Output b1 = 1. Feedback: 0⊕1⊕0⊕1 = 0.
- Step 2: State: 0010 → Output b1 = 0. Feedback: 0⊕0⊕1⊕0 = 1.
- Step 3: State: 1001 → Output b1 = 1. Feedback: 1⊕0⊕0⊕1 = 0.
- Step 4: State: 0100 → Output b1 = 0. Feedback: 0⊕1⊕0⊕0 = 1.
- Step 5: State: 1010 → Cycle completes! State repeats every 5 steps.

Generating 15 consecutive bits:
Bits 1–5: 0 1 0 1 0
Bits 6–10: 0 1 0 1 0
Bits 11–15: 0 1 0 1 0

👉 15-Bit Keystream: 01010 01010 01010.
Key Insight: The period is only 5 bits (far below the maximal period 2⁴ - 1 = 15) because the feedback polynomial x⁴ + x³ + x² + x + 1 is not primitive over GF(2)!

Problem 11: DES Modes of Operation Transmission Error Propagation Grid (Official Practice Problem 11)

Problem Statement:
Consider 6 plaintext blocks P1, ..., P6 encrypted under DES into ciphertext blocks C1, ..., C6 across five modes: ECB, CBC, OFB, CFB, and Counter (CTR).
(a) Encryption Error: Suppose a 1-bit error occurs in plaintext blocks P2 and P3 during encryption. Mark which resulting ciphertext blocks change.
(b) Decryption Error: Suppose a 1-bit transmission error occurs in ciphertext blocks C2 and C3 before decryption. Mark which recovered plaintext blocks change.


Step-by-Step Solution & Answer Grids:
(a) Encryption Error in P2 and P3:
- ECB: C2, C3 change (independent block mapping).
- CBC: C2, C3, C4, C5, C6 change! Because in CBC, Ci = E(Pi ⊕ Ci-1), corrupted ciphertexts feed forward indefinitely into all subsequent blocks.
- OFB: C2, C3 change (keystream is generated independent of plaintext).
- CFB: C2, C3, C4, C5, C6 change (corrupted ciphertext feeds into the shift register).
- Counter: C2, C3 change (pure parallel stream mode).

ModeC1C2C3C4C5C6
ECB✓✓
CBC✓✓✓✓✓
OFB✓✓
CFB✓✓✓✓✓
Counter✓✓

(b) Decryption Error in C2 and C3:
- ECB: P2, P3 change.
- CBC: P2, P3, P4 change! (Error in C2 garbles P2 and flips 1 bit in P3; error in C3 garbles P3 and flips 1 bit in P4. Block P5 self-synchronizes and recovers cleanly!).
- OFB: P2, P3 change (0-bit error propagation).
- CFB: P2, P3, P4 change.
- Counter: P2, P3 change (0-bit error propagation).

ModeP1P2P3P4P5P6
ECB✓✓
CBC✓✓✓
OFB✓✓
CFB✓✓✓
Counter✓✓
Problem 12: Elliptic Curve Cryptography Point Doubling 2P on GF(11)

Problem Statement:
Given elliptic curve y² ≡ x³ + x + 6 (mod 11), and point P = (2, 7).
(a) Verify that P lies on the curve.
(b) Calculate the coordinates of point doubling 2P over GF(11).


Step-by-Step Solution:
1. Verification of P(2, 7):
LHS = 7² = 49 ≡ 5 (mod 11).
RHS = 2³ + 2 + 6 = 8 + 2 + 6 = 16 ≡ 5 (mod 11).
LHS ≡ RHS ≡ 5 (mod 11) ✓. Point P is valid.

2. Tangent Slope m for Point Doubling 2P:
m ≡ (3x₁² + a) · (2y₁)⁻¹ (mod 11)
- Numerator: 3(2²) + 1 = 12 + 1 = 13 ≡ 2 (mod 11).
- Denominator: 2(7) = 14 ≡ 3 (mod 11).
- 3⁻¹ mod 11 = 4 (since 3 × 4 = 12 ≡ 1).
Slope: m ≡ 2 × 4 = 8 (mod 11).

3. Coordinates of 2P = (x₃, y₃):
- x₃ ≡ (m² - 2x₁) mod 11 = (64 - 4) mod 11 = 60 mod 11 = 5.
- y₃ ≡ [m(x₁ - x₃) - y₁] mod 11 = [8(2 - 5) - 7] = -24 - 7 = -31 mod 11 = 2.

👉 Resulting Point: 2P = (5, 2).

Problem 13: BPCS Steganography Complexity Derivation & Checkerboard Conjugation

Problem Statement:
In the BPCS steganography algorithm, an 8×8 bit image block contains total border transitions k = 25. Given kmax = 112 and threshold α0 = 0.3:
(a) Determine whether this block is classified as informative or complex.
(b) Should this block be embedded directly, or does it require conjugation? Calculate the resulting complexity α after conjugation.


Step-by-Step Solution:
1. Initial Complexity:
α = k / kmax = 25 / 112 ≈ 0.2232.

2. Threshold Evaluation:
Since α = 0.2232 < α0 (0.3), the block is classified as an informative (simple) block. It must not be embedded directly because human visual perception is extremely sensitive to changes in flat regions.

3. Conjugation Transformation:
The block is XORed with a standardized checkerboard pattern Wc. The resulting complexity inverts:
α(P*) = 1 - α(P) = 1 - (25 / 112) = 87 / 112 ≈ 0.7768.
Because 0.7768 ≥ 0.3, the block is now complex and safe to embed, with its conjugation flag recorded in the conjugation map.

Flashcards 15. Active Recall Exam Flashcards (25 High-Yield Cards) Fast Exam Drill

Use this active recall flashcard deck to drill high-frequency concepts, attack vectors, and mathematical conditions. Click the card or press Space to flip, and use arrow keys ← / → to navigate.

Card 1 of 25 Slide 01: Introduction Unrated
QUESTION
Loading card...
Click card or press [Space] to reveal answer ↵

Cheat-Sheet 16. Master Cram Matrix & Formula Quick-Sheet Comprehensive Summary

Integrated quick-reference matrix summarizing key technical parameters, algebraic foundations, block/key dimensions, and critical attack vectors across the complete IF4020 pre-midterm curriculum.

Family Cipher / Protocol Key & Block Dimensions Mathematical Foundation / Structure Critical Vulnerability / Primary Attack
Classical Mono Affine Cipher a ∈ {12 values}, b ∈ [0, 25] C ≡ aP + b (mod 26), condition: gcd(a, 26) = 1 Unigram frequency analysis • Small key space (312 keys).
Classical Poly Vigenère Cipher Keyword length m Ci ≡ Pi + Ki mod m (mod 26) Kasiski examination • Index of Coincidence (IC) • Friedman test.
Classical Matrix Hill Cipher Matrix m×m over ℤ₂₆ C ≡ KP (mod 26), condition: gcd(det(K), 26) = 1 Known-Plaintext Attack (KPA): K = C · P⁻¹ mod 26.
Unconditional One-Time Pad (Vernam) Key length ≥ plaintext C = P ⊕ K, Shannon's Perfect Secrecy Theorem Two-Time Pad: C₁ ⊕ C₂ = P₁ ⊕ P₂ (Project Venona).
Modern Stream LFSR Register of n bits Primitive polynomial over GF(2), max period 2ⁿ - 1 Berlekamp-Massey: Linearity broken using 2n keystream bits.
Modern Stream A5/1 (GSM) R1(19) + R2(22) + R3(23) = 64 bits Irregular majority clocking rule: maj(c1, c2, c3) Time-Memory Trade-off (TMTO) • Small 64-bit state space.
Modern Stream RC4 1 – 256 bytes 256-byte S-box array: KSA (key schedule) + PRGA (keystream) Initial byte bias (FMS attack on WEP) → Mandatory RC4-drop.
Standard Block DES (1977) 64-bit block • 56-bit key (+8 parity) 16 Feistel rounds, 8 S-Boxes (6-to-4 bits), expansion 32 → 48 bits Exhaustive Brute Force (2⁵⁶ too small) • Linear Cryptanalysis.
Standard Block 3DES (EDE) 64-bit block • 112 / 168-bit key EDE: C = EK3(DK2(EK1(P))) Backward compatible if K1=K2=K3 • Sweet32 64-bit collision attack.
Standard Block AES (Rijndael, 2001) 128-bit block • 128/192/256-bit key SPN 10/12/14 rounds: SubBytes, ShiftRows, MixColumns, AddRoundKey MixColumns omitted in last round • Structurally resilient to theoretical attacks.
Other Block IDEA (1990) 64-bit block • 128-bit key Combines XOR, addition mod 2¹⁶, and multiplication mod 2¹⁶+1 Uses zero S-Boxes • Featured in PGP 2.0.
Public-Key RSA (1977) 2048 – 4096-bit modulus Prime factoring n = p·q, ed ≡ 1 mod φ(n) Multiplicative homomorphism / CCA • Wiener • Requires OAEP padding.
Public-Key Diffie-Hellman (1976) 2048 – 4096-bit modulus Discrete Logarithm Problem (DLP) in ℤp* Unauthenticated → Vulnerable to Man-in-the-Middle (MitM).
Public-Key ElGamal (1985) 2048 – 4096-bit modulus DLP in ℤp* • c = (gᵏ mod p, m·yᵏ mod p) 2× ciphertext expansion • Ephemeral key reuse leaks plaintext ratio.
Public-Key Merkle-Hellman Knapsack n-bit weight vector Subset-Sum NP-complete disguised from superincreasing O(n) Completely broken by Adi Shamir (1982) via LLL lattice reduction.
Public-Key ECC (Elliptic Curve) 256-bit key (matches 3072-bit RSA) ECDLP on Weierstrass curve y² = x³ + ax + b (mod p) No sub-exponential attacks exist (Index Calculus cannot run on general curves).
Steganography BPCS (1997) Complexity threshold α₀ ≈ 0.3 8 bit-planes, complexity α = k/112, checkerboard XOR conjugation High 30%–50% capacity with zero visual artifacts • Conjugation map in header.
Steganography NoStega (2012) Zero cover carrier file GraphStega (business/scientific charts), ChessStega (FIDE-valid chess moves) Eliminates carrier distortion and anomaly detection entirely.
Watermarking Digital Watermarking Robust vs Fragile vs Semi-fragile Protects and authenticates the carrier medium itself as the primary asset Robust for copyright assertion • Fragile for tamper detection (medical/court).