🛡️ Physical-Layer Security: The Information-Theoretic Paradigm
Harnessing Channel Noise, Stochastic Uncertainty, and Wiretap Coding for Unconditional Secrecy
(Synthesized from Information Theory, Shannon's Perfect Secrecy, Wyner's Wiretap Channel, and Maurer's Key Agreement)
🎯 The Executive Pitch
Modern digital security is built upon a delicate mathematical assumption: computational hardness. Today's public-key cryptosystems (such as RSA, Diffie-Hellman, and Elliptic Curve Cryptography) do not make messages impossible to decode; they merely make decoding computationally expensive based on unproven mathematical conjectures (like the hardness of integer factorization or discrete logarithms). As quantum computing architectures (e.g., Shor's algorithm) and distributed computing clusters advance, these mathematical barriers face unprecedented vulnerabilities.
Physical-Layer Security (PLS) fundamentally reframes the security challenge. Instead of treating the underlying physical communication channel as an error-prone nuisance that must be abstracted away by higher network layers, PLS treats the intrinsic stochastic noise, fading, and spatial uncertainty of the physical medium as an unforgeable cryptographic resource. Grounded in Claude Shannon’s perfect secrecy, Aaron Wyner’s wiretap channel, and Ueli Maurer’s secret-key agreement protocols, PLS guarantees confidentiality based on the laws of physics and information theory—achieving security that holds regardless of how much computing power an adversary possesses.
📋 Learning Objectives
By running, modifying, and interacting with this notebook, you will:
- [x] Deconstruct the Layered Security "Patchwork": Understand why traditional protocol stacks neglect the physical layer and how information-theoretic security closes this foundational vulnerability.
- [x] Master Shannon’s Perfect Secrecy & The One-Time Pad: Mathematically prove why conditional entropy $H(M|X) = H(M)$ requires $H(K) \ge H(M)$, and explore the 3 logistical bottlenecks of Vernam's cipher.
- [x] Explore Wyner’s Wiretap Channel & Secrecy Capacity: Discover how channel noise can be converted into cryptographic armor when the eavesdropper’s link is noisier than the legitimate link ($C_s > 0$).
- [x] Simulate & Animate Binary Erasure Wiretap Coding: Build a dynamic parity-coding simulation demonstrating how Eve's uncertainty surges to 100% as codeword length increases.
- [x] Demystify Maurer’s Public Feedback Paradox: Discover how Alice and Bob can distill pristine, provably secure keys even when the eavesdropper has a better channel than the legitimate receiver.
- [x] Analyze Active Attacks & Physical Countermeasures: Explore channel reciprocity, Channel State Information (CSI) fingerprinting, and cooperative artificial noise jamming.
- [x] Solve Deep Masterclass Problems with Step-by-Step Rationales: Work through rigorous, fully explained mathematical and engineering problems with complete diagnostic solutions.
# Setup & Core Dependencies
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from scipy.stats import entropy
import warnings
warnings.filterwarnings('ignore')
# Visual aesthetics configuration
plt.rcParams['figure.dpi'] = 120
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.size'] = 10
plt.rcParams['axes.spines.top'] = False
plt.rcParams['axes.spines.right'] = False
plt.rcParams['axes.grid'] = True
plt.rcParams['grid.alpha'] = 0.3
plt.rcParams['grid.linestyle'] = '--'
# Safe HTML display import for zero-dependency animation rendering
try:
from IPython.display import HTML, display
except ImportError:
HTML = lambda x: x
display = print
print("🚀 Environment configured successfully! Ready for Physical-Layer Security simulation.")
Module 1: The Layered Protocol Stack & The "Patchwork" Paradox
💡 Layer 1: The Intuitive Hook — The Fortified Penthouse vs. The Open Basement
Imagine building an ultra-luxurious skyscraper. On the top floors, you install biometric palm scanners, retinal cameras, bank-grade vault doors, and encrypted intercoms. Every resident feels completely impenetrable.
However, you completely forgot to secure the foundation: the basement doors are unlocked, the utility tunnels are unguarded, and the water pipes are exposed to the street. Anyone with a pair of pliers can tap directly into the building's physical lifelines before the security systems on the top floors even know what happened!
This is the exact state of modern computer networking:
- The Layered Protocol Model: In the standard OSI and TCP/IP models, communication tasks are partitioned into modular abstractions: Application (Layer 7/5), Transport (Layer 4), Network (Layer 3), Data Link (Layer 2), and Physical (Layer 1).
- The Security Patchwork: Because network security was an afterthought in the early, tightly controlled days of ARPANET and the early Internet, security mechanisms were progressively tacked onto higher layers—SSL/TLS at the transport/application layer, IPsec at the network layer, and MACsec at the link layer.
- The Overlooked Foundation: The Physical Layer—which converts abstract bits into electromagnetic radio waves, optical pulses, or voltage signals—has remained almost entirely ignored for security.
In wireless environments, electromagnetic waves radiate omnidirectionally through physical space. Anyone with an antenna within line-of-sight can capture the raw waveform. Rather than ignoring this physical reality, Physical-Layer Security (PLS) asks: Can we use the physical noise, fading, and spatial geometry inherent to the communication channel itself to build an unforgeable foundation for data confidentiality?
🏛️ Architectural Comparison: Where Does Security Belong?
+-------------------------------------------------------------------------+
| THE TRADITIONAL SECURITY PATCHWORK |
+-------------------------------------------------------------------------+
| Layer 7: Application | HTTPS / TLS, PGP, SSH, Passwords |
| Layer 4: Transport | TLS / DTLS Encryption |
| Layer 3: Network | IPsec, WireGuard VPNs |
| Layer 2: Data Link | WPA3 / MACsec (Often vulnerable to beacons) |
| Layer 1: PHYSICAL | NO SECURITY! Raw RF signals broadcast in space |
+-------------------------------------------------------------------------+
+-------------------------------------------------------------------------+
| THE PHYSICAL-LAYER SECURITY PARADIGM |
+-------------------------------------------------------------------------+
| Higher Layers | Computational Encryption (AES, RSA, ECC) |
| | (End-to-end confidentiality & authorization) |
| ^ | ^ |
| | | | Complementary Synergy |
| v | v |
| Layer 1: PHYSICAL | PHYSICAL-LAYER SECURITY (Information-Theoretic)|
| | - Channel noise exploitation (Wiretap coding) |
| | - Multipath CSI authentication & reciprocity |
| | - Cooperative jamming & artificial noise |
| | - Secret-key distillation from channel entropy |
+-------------------------------------------------------------------------+
Why Was Physical-Layer Security Neglected for Decades?
In typical graduate curricula, cryptography is introduced by discussing Claude Shannon's 1949 landmark theorem on "Perfect Secrecy." However, instructors almost immediately dismiss Shannon's theorem as an "impractical theoretical curiosity" because it requires a secret key as long as the message itself. Students are quickly ushered into computational cryptography (prime factorization, discrete logs, AES).
As we will demonstrate in this notebook, Shannon's pessimism was based on the assumption of an error-free channel. Once we introduce the realistic physics of noisy, independent communication channels, information-theoretic security becomes not only possible, but profoundly practical!
Module 2: Shannon’s Perfect Secrecy & The One-Time Pad (1949)
💡 Layer 1: The Intuitive Hook — The Chameleon Mirror
Suppose Alice wants to send Bob a secret letter through a transparent glass pipe where an eavesdropper, Eve, inspects every letter that passes through.
Alice takes each letter of her message and blends it with a completely unpredictable color from a magic palette (the secret key). When Eve looks through the glass, she sees a color that could represent literally any letter in the alphabet with equal likelihood. Looking at the colored card gives Eve zero clues: the letter is just as likely to be "A" as it is to be "Z".
When Bob receives the card, he applies the matching color from his twin palette, instantly restoring the original letter.
However, there is a catch: Alice's magic palette must contain just as many unique color swatches as there are letters in the message, and no color swatch can ever be reused. If Alice reuses a swatch on two different letters, Eve can compare the two cards and mathematically deduce both messages!
📐 Layer 2: Mathematical Anatomy of Perfect Secrecy
In his seminal 1949 paper "Communication Theory of Secrecy Systems", Claude Shannon formalized cryptographic uncertainty using entropy.
Let the message $M$, secret key $K$, and transmitted cryptogram (ciphertext) $X$ be random variables. Secrecy is quantified by the conditional entropy of the message given the ciphertext, denoted as $H(M|X)$, also known as the eavesdropper's equivocation.
1. Shannon's Perfect Secrecy Condition
A cryptosystem achieves perfect secrecy if and only if:
This equation states that observing the ciphertext $X$ provides zero mutual information about the plaintext message $M$:
The ciphertext $X$ and the message $M$ are completely statistically independent:
2. The Fundamental Pessimistic Bound
Shannon proved that to achieve perfect secrecy over an error-free channel:
For uniformly distributed binary messages of length $L$ bits, this implies that the key length must be at least as long as the message:
| Symbol | Definition | Information-Theoretic Meaning |
|---|---|---|
| $M$ | Plaintext Message | Random variable representing the confidential data |
| $K$ | Secret Key | Random variable known strictly to Alice and Bob |
| $X$ | Ciphertext / Codeword | Transmitted signal observed by Eve over the public wire |
| $H(M)$ | Message A Priori Entropy | The baseline uncertainty about the message |
| $H(M \mid X)$ | Eavesdropper's Equivocation | Eve's remaining uncertainty about $M$ after observing $X$ |
| $I(M; X)$ | Mutual Information | Information leaked to Eve ($I(M; X) = 0$ for perfect secrecy) |
⚙️ The One-Time Pad (Vernam's Cipher)
The classic realization of perfect secrecy is the One-Time Pad (OTP), patented by Gilbert Vernam in 1917:
- Encryption: Alice takes message bit vector $M \in \{0, 1\}^L$ and independent uniform random key $K \in \{0, 1\}^L$:
$$X = M \oplus K$$ - Decryption: Bob receives $X$ and adds the identical key:
$$\hat{M} = X \oplus K = (M \oplus K) \oplus K = M \oplus (K \oplus K) = M \oplus \mathbf{0} = M$$ - Eve's View: For every possible message $m \in \{0, 1\}^L$, there exists a unique key $k = x \oplus m$. Since all $2^L$ keys are equally likely ($P(K = k) = 2^{-L}$):
$$P(X = x \mid M = m) = P(K = x \oplus m) = 2^{-L}$$
Therefore, by Bayes' Rule, $P(M = m \mid X = x) = P(M = m)$. Eve learns absolutely nothing!
⚠️ The 3 Fatal Bottlenecks of the One-Time Pad
Despite its mathematical perfection, the One-Time Pad was abandoned for general consumer networks due to three crippling practical constraints:
- Massive Key Storage & Generation: To transmit gigabytes of streaming video, Alice and Bob must pre-generate and store gigabytes of truly random physical bits.
- The Catastrophic Key Reuse Vulnerability: If key $K$ is reused to encrypt messages $M_1$ and $M_2$:
$$X_1 \oplus X_2 = (M_1 \oplus K) \oplus (M_2 \oplus K) = M_1 \oplus M_2$$
The key cancels out entirely! Frequency analysis and crib-dragging quickly recover both plaintexts. - The Key Distribution Paradox (Catch-22): To securely share the secret key $K$ in the first place, Alice and Bob need a secure channel. But if they already had a secure channel, they wouldn't need the One-Time Pad!
🚨 The "Pseudo-Random" Illusion
Engineers often attempt to salvage the OTP by using a short seed (e.g., 256 bits) to generate a long pseudo-random keystream via a PRNG or stream cipher (such as ChaCha20 or AES-CTR).
However, information theory proves that the eavesdropper's uncertainty is strictly upper-bounded by the entropy of the seed:
Once the message exceeds 256 bits, Eve can perform a brute-force search over the seed space. True information-theoretic security collapses into computational security!
# Interactive Demonstration: Shannon's One-Time Pad & The Key Reuse Trap
def string_to_bits(s: str) -> np.ndarray:
# Convert ASCII string to a NumPy array of bits (0s and 1s)
byte_array = np.frombuffer(s.encode('ascii'), dtype=np.uint8)
return np.unpackbits(byte_array)
def bits_to_string(b: np.ndarray) -> str:
# Convert NumPy array of bits back to ASCII string
byte_array = np.packbits(b)
return byte_array.tobytes().decode('ascii', errors='replace')
# 1. Define confidential messages
message_1 = "ATTACK AT DAWN!"
message_2 = "CANCEL MISSION!"
m1_bits = string_to_bits(message_1)
m2_bits = string_to_bits(message_2)
# Ensure equal length for demonstration
min_len = min(len(m1_bits), len(m2_bits))
m1_bits = m1_bits[:min_len]
m2_bits = m2_bits[:min_len]
# 2. Generate a true uniform random key (same length as message)
np.random.seed(42)
one_time_key = np.random.randint(0, 2, size=min_len, dtype=np.uint8)
# 3. Encrypt both messages
ciphertext_1 = m1_bits ^ one_time_key
ciphertext_2 = m2_bits ^ one_time_key # DANGEROUS: Reusing the same key!
# 4. Decryption by Bob (Flawless)
decrypted_m1 = bits_to_string(ciphertext_1 ^ one_time_key)
decrypted_m2 = bits_to_string(ciphertext_2 ^ one_time_key)
# 5. Eve intercepts both ciphertexts and computes their XOR
eve_xor_leak = ciphertext_1 ^ ciphertext_2
theoretical_xor = m1_bits ^ m2_bits
print("=== SHANNON ONE-TIME PAD DEMONSTRATION ===")
print(f"Original M1: '{message_1}'")
print(f"Original M2: '{message_2}'")
print(f"Key (first 32 bits): {one_time_key[:32]}...")
print(f"Ciphertext 1 (hex): {np.packbits(ciphertext_1).tobytes().hex()}")
print(f"Decrypted by Bob M1: '{decrypted_m1}'")
print(f"Decrypted by Bob M2: '{decrypted_m2}'")
print("\n=== EVE'S ATTACK ON KEY REUSE ===")
print(f"Ciphertext 1 XOR Ciphertext 2 matches M1 XOR M2: {np.array_equal(eve_xor_leak, theoretical_xor)}")
print(f"XOR Leakage reveals non-random ASCII structure: {eve_xor_leak[:32]}...")
print("-> Notice: The secret key has vanished entirely from C1 ^ C2!")
Module 3: Wyner’s Wiretap Channel & Secrecy Capacity (1975)
💡 Layer 1: The Intuitive Hook — The Whisper in the Storm
Shannon’s pessimistic conclusion ($H(K) \ge H(M)$) hinged on a critical, worst-case assumption: the eavesdropper observes an error-free, pristine copy of the ciphertext.
In 1975, Bell Labs researcher Aaron Wyner asked a revolutionary question:
What if the physical world is inherently noisy? What if Bob is standing close to Alice in a quiet room, while the eavesdropper, Eve, is hiding down the hall in a noisy cafeteria?
If Alice talks just quietly enough, Bob can hear her voice clearly above his minor background hum. But to Eve, Alice's words are drowned out by the roar of the cafeteria.
Wyner proved something astonishing: If the eavesdropper’s physical channel is noisier than the legitimate receiver’s channel, Alice can transmit confidential messages to Bob with ZERO pre-shared secret key, ZERO error at Bob, and ZERO information leaked to Eve!
📐 Layer 2: Mathematical Anatomy of the Wiretap Channel
In Wyner's wiretap model, communication takes place over a discrete memoryless broadcast channel:
+---------+ X^n +----------------+ Y^n +---------+
Alice (M) ---> | Encoder | ------> | Main Channel | ------> | Decoder | ---> Bob (M_hat)
+---------+ | | P(Y|X) | +---------+
| +----------------+
|
| +----------------+ Z^n +-------------+
+--> | Wiretap Channel| ------> | Eavesdropper| ---> Eve (Equivocation)
| P(Z|X) | +-------------+
+----------------+
- Codeword Transmission: Alice encodes message $M \in \{1, 2, \dots, 2^{nR}\}$ into a codeword $X^n = (X_1, X_2, \dots, X_n)$ of $n$ channel symbols.
- Main Channel: Bob receives sequence $Y^n \sim P(Y^n | X^n)$ and computes an estimate $\hat{M}$.
- Wiretap Channel: Eve observes sequence $Z^n \sim P(Z^n | X^n)$.
1. Wyner's Asymptotic Secrecy Condition
Instead of demanding exact perfect secrecy for a single symbol ($H(M|X) = H(M)$), Wyner formulated the equivocation rate for long block lengths $n$:
Simultaneously, the probability of error at the legitimate receiver must vanish asymptotically:
2. The Secrecy Capacity ($C_s$)
The secrecy capacity $C_s$ is the maximum transmission rate $R$ (in bits per channel use) that satisfies both reliability at Bob and perfect equivocation at Eve.
For a degraded wiretap channel (where $X \to Y \to Z$ forms a Markov chain):
Where:
- $I(X; Y)$ is the mutual information between Alice and Bob (capacity of the main channel $C_M$).
- $I(X; Z)$ is the mutual information between Alice and Eve (capacity of the wiretap channel $C_W$).
🔑 The Core Takeaway
Whenever the legitimate receiver has an informational advantage over the eavesdropper ($C_M > C_W$), the secrecy capacity is strictly positive ($C_s > 0$). Alice and Bob can exchange perfectly confidential messages at rate $C_s$ without needing any pre-shared secret keys!
Module 4: Concrete Coding for Secrecy: The Binary Erasure Wiretap Channel
💡 Layer 1: The Intuitive Hook — The Missing Jigsaw Puzzle Piece
How can a code guarantee reliability for Bob while completely blinding Eve?
Imagine a 100-piece jigsaw puzzle where the picture is a simple binary question: "Is the total number of black dots on all pieces even or odd?"
- Bob receives every single puzzle piece without damage. He counts the black dots, checks whether the sum is even or odd, and knows the secret with 100% certainty.
- Eve inspects the puzzle pieces during delivery, but postal damage randomly destroys (erases) a few pieces.
Even if Eve recovers 99 out of the 100 pieces perfectly, the single missing piece could have an even or an odd number of dots! Because that single missing piece flips the entire total, Eve is left completely in the dark. Her odds of guessing the answer remain exactly 50/50!
This is the mathematical essence of Parity Wiretap Coding.
📐 Layer 2: Mathematical Anatomy of Parity Coding on the BEC
Let Alice transmit to Bob over an error-free channel ($Y = X$), while Eve observes through a Binary Erasure Channel (BEC) with erasure probability $\epsilon \in (0, 1)$:
X in {0, 1}
/ \
(1 - eps) / \ eps
v v
Z in {0, 1} Z = '?' (Erasure)
1. Uncoded Transmission (The Baseline)
If Alice sends a single uncoded bit $M \in \{0, 1\}$ ($n = 1$):
- Eve receives the bit correctly with probability $1 - \epsilon$.
- Eve suffers an erasure with probability $\epsilon$.
- Eve's equivocation is simply:
$$H(M \mid Z) = \epsilon$$
If $\epsilon = 0.2$ (Eve loses only 20% of symbols), Eve obtains 80% of the information! Uncoded transmission is completely insecure.
2. The Parity-Check Wiretap Code (Length $n$)
To protect a 1-bit message $M \in \{0, 1\}$, Alice constructs a codeword $X^n = (X_1, X_2, \dots, X_n)$ of length $n$:
- Alice picks the first $n-1$ bits $(X_1, X_2, \dots, X_{n-1})$ uniformly at random from $\{0, 1\}$.
- Alice sets the final parity bit $X_n$ such that the total sum matches $M$:
$$\bigoplus_{i=1}^n X_i = M \iff X_n = M \oplus \left(\bigoplus_{i=1}^{n-1} X_i\right)$$
3. Bob's Decoding
Since Bob's channel is error-free, Bob receives $Y^n = X^n$. Bob decodes by taking the XOR sum:
Bob achieves zero error probability: $P(\hat{M} \ne M) = 0$.
4. Eve's Equivocation Analysis
Eve observes $Z^n = (Z_1, Z_2, \dots, Z_n)$, where each $Z_i \in \{0, 1, ?\}$ independently.
- What is the probability that Eve receives all $n$ bits with zero erasures?
$$P(\text{Zero Erasures}) = (1 - \epsilon)^n$$ - What is the probability that Eve suffers at least one erasure?
$$P(\text{At least 1 erasure}) = 1 - (1 - \epsilon)^n$$
If even a single bit $X_j$ is erased ($Z_j = ?$), the conditional distribution of $M$ given $Z^n$ remains perfectly uniform:
Therefore, Eve's equivocation is bounded from below by:
As codeword length $n \to \infty$, $(1 - \epsilon)^n \to 0$ exponentially fast!
⚖️ The Engineering Trade-off: Rate vs. Secrecy
The simple parity code transmits 1 bit of information over $n$ channel uses, so its code rate is $R = 1/n$. As $n \to \infty$, $R \to 0$.
In Chapter 3 and Chapter 6 of the textbook, advanced coset coding (using linear block codes such as LDPC and Polar codes) partitions the vector space into cosets, achieving non-zero secrecy rates $R = C_s > 0$ while maintaining exponential equivocation!
# ANIMATION 1: Dynamic Simulation of the Binary Erasure Wiretap Channel
# Visualizing Eve's Equivocation Surge and Parity Collapse as Codeword Length Increases
fig, (ax_stream, ax_equiv) = plt.subplots(1, 2, figsize=(14, 5.5))
fig.suptitle("Wyner's Wiretap Channel: Parity Coding on Binary Erasure Channel (BEC)", fontsize=13, fontweight='bold')
# Parameters
erasure_rate = 0.35 # Eve suffers 35% random erasure probability
max_n = 20 # Maximum codeword length
n_frames = 20
# Precompute theoretical equivocation curves for different epsilon
n_vals = np.arange(1, max_n + 1)
equiv_theory_eps = {
0.15: 1.0 - (1.0 - 0.15)**n_vals,
0.35: 1.0 - (1.0 - 0.35)**n_vals,
0.60: 1.0 - (1.0 - 0.60)**n_vals
}
# Fixed synthetic bits for reproducibility
np.random.seed(101)
sim_bits = np.random.randint(0, 2, size=max_n)
sim_message = 1 # Alice's secret message bit: M = 1
# Setup Subplot 1: Live Bit Transmission Buffer
ax_stream.set_xlim(-0.5, 9.5)
ax_stream.set_ylim(-0.5, 3.5)
ax_stream.set_yticks([0.5, 1.7, 2.9])
ax_stream.set_yticklabels(["Eve's Channel (BEC)", "Bob's Channel (Clean)", "Alice's Transmit"])
ax_stream.set_xlabel("Codeword Symbol Index", fontweight='bold')
ax_stream.set_title("Live Channel Symbol Flow (Frame-by-Frame)", fontweight='bold')
# Setup Subplot 2: Equivocation Convergence
ax_equiv.set_xlim(1, max_n)
ax_equiv.set_ylim(-0.05, 1.05)
ax_equiv.set_xlabel("Codeword Length (n)", fontweight='bold')
ax_equiv.set_ylabel("Eve's Equivocation H(M | Z^n) [Bits]", fontweight='bold')
ax_equiv.set_title("Eve's Uncertainty Surging Toward Perfect Secrecy", fontweight='bold')
for eps, curve in equiv_theory_eps.items():
lbl = f"Theoretical eps = {eps:.2f}"
ax_equiv.plot(n_vals, curve, linestyle='--', alpha=0.6, label=lbl)
equiv_line, = ax_equiv.plot([], [], 'ro-', linewidth=2.5, markersize=7, label=f"Current Run (eps={erasure_rate})")
current_marker, = ax_equiv.plot([], [], 'ko', markersize=10, fillstyle='none', markeredgewidth=2)
ax_equiv.axhline(1.0, color='darkgreen', linestyle=':', label="Shannon Perfect Secrecy (1.0 bit)")
ax_equiv.legend(loc='lower right', framealpha=0.9)
# Animated text objects for buffer
text_alice = []
text_bob = []
text_eve = []
# Generate channel realizations for Eve
eve_symbols = []
for i in range(max_n):
if np.random.rand() < erasure_rate:
eve_symbols.append('?')
else:
eve_symbols.append(str(sim_bits[i]))
def init():
equiv_line.set_data([], [])
current_marker.set_data([], [])
return equiv_line, current_marker
def update(frame):
n = frame + 1
# 1. Update Bit Stream Visualization (show last 10 symbols)
ax_stream.cla()
ax_stream.set_xlim(-0.5, 9.5)
ax_stream.set_ylim(-0.5, 3.5)
ax_stream.set_yticks([0.5, 1.7, 2.9])
ax_stream.set_yticklabels(["Eve's Channel (BEC)", "Bob's Channel (Clean)", "Alice's Transmit"], fontweight='bold')
ax_stream.set_xlabel("Codeword Symbol Window", fontweight='bold')
ax_stream.set_title(f"Channel State for Codeword Length n = {n}", fontweight='bold')
start_idx = max(0, n - 10)
visible_indices = list(range(start_idx, n))
has_erasure = False
for slot, idx in enumerate(visible_indices):
# Alice
b = sim_bits[idx]
ax_stream.text(slot, 2.9, str(b), fontsize=14, ha='center', va='center',
bbox=dict(boxstyle='square,pad=0.3', fc='#B3E5FC', ec='#0288D1'))
# Bob (error-free)
ax_stream.text(slot, 1.7, str(b), fontsize=14, ha='center', va='center',
bbox=dict(boxstyle='square,pad=0.3', fc='#C8E6C9', ec='#388E3C'))
# Eve (with erasures)
ev_sym = eve_symbols[idx]
if ev_sym == '?':
has_erasure = True
ax_stream.text(slot, 0.5, '?', fontsize=16, ha='center', va='center', fontweight='bold',
bbox=dict(boxstyle='square,pad=0.3', fc='#FFCDD2', ec='#D32F2F'))
else:
ax_stream.text(slot, 0.5, ev_sym, fontsize=14, ha='center', va='center',
bbox=dict(boxstyle='square,pad=0.3', fc='#E0E0E0', ec='#757575'))
# Check overall erasures in full codeword of length n
full_erasure_count = eve_symbols[:n].count('?')
if full_erasure_count > 0:
msg_status = f"Codeword n={n} | Eve has {full_erasure_count} erasure(s) -> Parity LOST! H(M|Z^n) = 1.0"
status_color = "#E8F5E9"
edge_color = "#2E7D32"
else:
msg_status = f"Codeword n={n} | Eve has 0 erasures -> Parity VULNERABLE! Leakage Prob = {(1-erasure_rate)**n:.3f}"
status_color = "#FFEBEE"
edge_color = "#C62828"
ax_stream.text(0.5, 0.05, msg_status, transform=ax_stream.transAxes,
fontsize=10, fontweight='bold', ha='center',
bbox=dict(boxstyle="round,pad=0.4", fc=status_color, ec=edge_color))
# 2. Update Equivocation Plot
curr_n = np.arange(1, n + 1)
curr_equiv = 1.0 - (1.0 - erasure_rate)**curr_n
equiv_line.set_data(curr_n, curr_equiv)
current_marker.set_data([n], [curr_equiv[-1]])
return equiv_line, current_marker
anim1 = animation.FuncAnimation(fig, update, init_func=init, frames=n_frames, interval=450, blit=False)
plt.close(fig) # Prevent static display
HTML(anim1.to_jshtml())
🔍 Critical Observations from Animation 1:
- The Exponential Wall: Notice how quickly the theoretical equivocation curve $1 - (1-\epsilon)^n$ approaches $1.0$ (perfect secrecy). For an erasure rate as modest as $\epsilon = 0.35$, by length $n = 10$, Eve's probability of correctly deducing the parity without an erasure is $(0.65)^{10} \approx 0.013$ (less than 1.4%). By $n = 15$, it drops to $0.0015$!
- The Fragility of Eve's Knowledge: In the live channel window, as soon as even a single red question mark (
?) appears in Eve's buffer, her mathematical ability to distinguish between $M=0$ and $M=1$ is destroyed. Parity is an all-or-nothing function. - The Bob Advantage: Bob experiences zero channel erasures, decoding the exact message with 100% precision by simply computing the modulo-2 sum of his received bits.
Module 5: Secret-Key Agreement from Noisy Observations (Maurer, 1993)
💡 Layer 1: The Intuitive Hook — The Public Megaphone Paradox
In Wyner’s wiretap channel, there was a major catch: Bob’s channel had to be strictly cleaner than Eve’s. If Eve sat closer to the transmitter or had a massive satellite dish, $C_{\text{Bob}} \le C_{\text{Eve}}$, resulting in a secrecy capacity of zero ($C_s = 0$).
In 1993, Swiss cryptographer Ueli Maurer and information theorists Rudolf Ahlswede & Imre Csiszár made a breakthrough that stunned the cryptographic community:
What if Alice and Bob are allowed to talk back and forth over a completely open, unencrypted, public channel (like an unencrypted radio broadcast or internet forum) that Eve can hear with 100% perfection?
Intuition screams that shouting over a public megaphone cannot help you keep secrets from an eavesdropper who has a better antenna than you.
Yet Maurer proved the exact opposite: Even if Bob's channel is substantially noisier than Eve's channel, Alice and Bob can use public discussion to invert the advantage, compounding Eve’s errors and distilling a 100% provably secure secret key!
📐 Layer 2: Mathematical Anatomy of Advantage Inversion
Consider an instance of the correlated observation model:
+-------------------+
| Random Source (X) |
+-------------------+
|
+---------------+---------------+
| |
Main Channel Wiretap Channel
Noise D ~ Bern(p_B) Noise E ~ Bern(p_E)
| |
v v
Bob: Y = X + D Eve: Z = X + E
|
+======== [ Public Feedback Channel: F ] ========> Alice & Eve
- Transmission: Alice transmits a random binary bit $X \in \{0, 1\}$.
- Bob's Observation: Bob receives $Y = X \oplus D$, where $D \sim \text{Bernoulli}(p_B)$.
- Eve's Observation: Eve receives $Z = X \oplus E$, where $E \sim \text{Bernoulli}(p_E)$.
- The Adversarial Advantage: Assume Bob’s channel is worse than Eve’s:
$$p_B > p_E$$
Under Wyner's classical model, $C_s = 0$. Confidential communication is impossible!
🔄 Maurer's Public Feedback Protocol
Now Bob introduces public feedback:
- Bob generates a completely independent, private random bit $V \in \{0, 1\}$.
- Bob adds his noisy channel observation $Y$ to $V$ and broadcasts the result $F$ over the public authenticated channel:
$$F = V \oplus Y = V \oplus X \oplus D$$ - Both Alice and Eve hear $F$ perfectly over the public channel.
🎯 Alice's Recovery of $V$
Alice already knows what symbol $X$ she transmitted! She simply adds $X$ to the public message $F$:
- Notice: Alice's estimate of $V$ is corrupted only by noise $D$ (error probability $p_B$).
🕵️ Eve's Estimation of $V$
Eve attempts to estimate $V$. What does Eve possess?
- The public message $F = V \oplus X \oplus D$.
- Her own channel observation $Z = X \oplus E$.
Eve's optimal linear estimate of $V$ is to add $F$ and $Z$:
- Look at the noise afflicting Eve: $D \oplus E$!
- By the XOR convolution lemma for independent Bernoulli variables, the probability of error seen by Eve is:
$$P(\text{Eve Error}) = P(D \oplus E = 1) = p_B(1 - p_E) + p_E(1 - p_B) = p_B + p_E - 2p_B p_E$$
🌟 The Advantage Inversion Proof
Since $0 < p_E < 0.5$, we have:
Even though Eve had a superior channel originally ($p_E < p_B$), Bob's public feedback forced Eve to combine her channel noise with Bob's channel noise! Alice now has a lower error rate than Eve!
🏭 The 3-Phase Practical Key Distillation Pipeline
In practical engineering, Alice and Bob convert these correlated noisy observations into a clean cryptographic key using a 3-step pipeline:
[ Phase 1: Correlated Source ]
Alice & Bob collect correlated bit vectors through the noisy physical channel.
|
v
[ Phase 2: Information Reconciliation (Error Correction) ]
Alice & Bob exchange parity/syndrome bits over the public channel to eliminate bit flips.
(Bob fixes his errors to match Alice 100%).
|
v
[ Phase 3: Privacy Amplification (Universal Hashing) ]
Alice & Bob pass the reconciled string through a 2-universal hash function (Toeplitz matrix).
This compresses out all partial bits that Eve may have learned, outputting a 100% secret key!
# ANIMATION 2: Dynamic Simulation of Maurer's Secret-Key Agreement & Advantage Inversion
# Proving that Public Feedback forces Eve's effective noise to exceed Bob's noise!
fig, (ax_rates, ax_pipe) = plt.subplots(1, 2, figsize=(14, 5.5))
fig.suptitle("Maurer's Key Agreement: Turning a Disadvantageous Channel into Secret Keys", fontsize=13, fontweight='bold')
# Parameters: Bob's channel is NOISIER than Eve's channel!
p_bob = 0.22 # Bob's bit flip probability (worse)
p_eve = 0.08 # Eve's bit flip probability (better)
# Eve's compounded error after public feedback: p_comp = p_B + p_E - 2*p_B*p_E
p_compounded = p_bob + p_eve - 2 * p_bob * p_eve
# Subplot 1: Error Rates Comparison Bar Chart
bars = ax_rates.bar(["Bob's Raw Noise\n(p_B)", "Eve's Raw Noise\n(p_E)", "Alice's Error on V\n(p_B)", "Eve's Compounded Error\n(p_B + p_E - 2*p_B*p_E)"],
[p_bob, p_eve, p_bob, p_compounded],
color=['#FFB74D', '#4FC3F7', '#81C784', '#E57373'],
edgecolor='black', linewidth=1.2)
ax_rates.set_ylabel("Error Probability", fontweight='bold')
ax_rates.set_ylim(0, 0.35)
ax_rates.set_title("Advantage Inversion via Public Discussion", fontweight='bold')
for bar in bars:
yval = bar.get_height()
ax_rates.text(bar.get_x() + bar.get_width()/2.0, yval + 0.01, f"{yval:.3f}", ha='center', va='bottom', fontweight='bold')
ax_rates.axhline(p_bob, color='gray', linestyle=':', alpha=0.7)
# Subplot 2: Dynamic Bit Distillation Stream
ax_pipe.set_xlim(-0.5, 9.5)
ax_pipe.set_ylim(-0.5, 4.5)
ax_pipe.set_yticks([0.5, 1.5, 2.5, 3.5])
ax_pipe.set_yticklabels([
"Phase 3: Final Key (Hash)",
"Phase 2: Reconciled String",
"Phase 1: Eve's Estimate (V + D + E)",
"Phase 1: Alice's Estimate (V + D)"
], fontweight='bold')
ax_pipe.set_xlabel("Bit Pipeline Index", fontweight='bold')
ax_pipe.set_title("3-Phase Secret-Key Distillation in Action", fontweight='bold')
# Synthetic bit stream generation
n_bits = 100
np.random.seed(42)
X_stream = np.random.randint(0, 2, size=n_bits)
D_noise = (np.random.rand(n_bits) < p_bob).astype(int)
E_noise = (np.random.rand(n_bits) < p_eve).astype(int)
V_secret = np.random.randint(0, 2, size=n_bits)
# Alice gets V ^ D; Eve gets V ^ D ^ E
alice_V = V_secret ^ D_noise
eve_V = V_secret ^ D_noise ^ E_noise
def init_m():
return []
def update_m(frame):
ax_pipe.cla()
ax_pipe.set_xlim(-0.5, 9.5)
ax_pipe.set_ylim(-0.5, 4.5)
ax_pipe.set_yticks([0.5, 1.5, 2.5, 3.5])
ax_pipe.set_yticklabels([
"Phase 3: Clean Secret Key",
"Phase 2: Reconciled Bits",
"Phase 1: Eve V^(D+E)",
"Phase 1: Alice V^D"
], fontweight='bold')
ax_pipe.set_xlabel("Sliding Window Index", fontweight='bold')
start_idx = max(0, frame - 10)
visible_indices = list(range(start_idx, frame + 1))
for slot, idx in enumerate(visible_indices):
a_bit = alice_V[idx]
e_bit = eve_V[idx]
true_v = V_secret[idx]
# Row 3.5: Alice
a_err = (a_bit != true_v)
c_a = '#FFCDD2' if a_err else '#C8E6C9'
ax_pipe.text(slot, 3.5, str(a_bit), fontsize=12, ha='center', va='center',
bbox=dict(boxstyle='square,pad=0.25', fc=c_a, ec='black', lw=0.8))
# Row 2.5: Eve
e_err = (e_bit != true_v)
c_e = '#FFCDD2' if e_err else '#E0E0E0'
ax_pipe.text(slot, 2.5, str(e_bit), fontsize=12, ha='center', va='center',
bbox=dict(boxstyle='square,pad=0.25', fc=c_e, ec='black', lw=0.8))
# Row 1.5: Reconciled (Alice and Bob match 100% via parity exchange)
ax_pipe.text(slot, 1.5, str(true_v), fontsize=12, ha='center', va='center',
bbox=dict(boxstyle='square,pad=0.25', fc='#BBDEFB', ec='#1565C0', lw=0.8))
# Row 0.5: Privacy Amplification (condensed hashed blocks)
if slot % 3 == 0:
hash_bit = (true_v ^ (idx % 2))
ax_pipe.text(slot + 1, 0.5, f"K[{idx//3}]={hash_bit}", fontsize=10, ha='center', va='center', fontweight='bold',
bbox=dict(boxstyle='round,pad=0.3', fc='#D1C4E9', ec='#512DA8', lw=1.2))
ax_pipe.set_title(f"Processed Bits: {frame + 1} / {n_bits} | Eve Errors > Alice Errors", fontweight='bold')
return []
anim2 = animation.FuncAnimation(fig, update_m, init_func=init_m, frames=30, interval=350, blit=False)
plt.close(fig)
HTML(anim2.to_jshtml())
🔍 Critical Observations from Animation 2:
- The Inversion of Superiority: In the left bar chart, Eve starts with a far superior channel ($p_E = 0.08$ vs. $p_B = 0.22$). Yet after Bob's public feedback step, Eve's error rate surges to $0.265$—making her significantly more uncertain than Alice ($0.220$)!
- Decoupling Reliability from Secrecy: Unlike Wyner's wiretap codes (which must simultaneously solve transmission reliability and confidentiality in a single code), key distillation cleanly decouples the two:
- Phase 2 (Information Reconciliation): Corrects the errors between Alice and Bob over the public channel using standard forward error-correcting codes (e.g., LDPC or BCH syndrome exchange).
- Phase 3 (Privacy Amplification): Universal hashing squeezes out Eve's partial knowledge, transforming the shared string into an information-theoretically secure key that can now be used as a One-Time Pad!
Module 6: Active Attacks & Physical-Layer Countermeasures
💡 Layer 1: The Intuitive Hook — The Imposter at the Door vs. The Acoustical Fingerprint
So far, we have assumed that Eve is a polite, passive spectator who only listens quietly from the shadows. But what if Eve goes active?
- What if Eve uses a high-powered transmitter to shout over Alice (Jamming)?
- What if Eve injects fake data packets pretending to be Alice (Spoofing / Impersonation)?
At higher network layers, we use cryptographic certificates and digital signatures to verify identity. But what if an attacker steals the private key or compromises a Certificate Authority?
At the physical layer, every wireless transmitter has a physical characteristic that is virtually impossible to counterfeit: the unique multipath impulse response of the wireless channel. Just as a human voice reverberates differently in a cathedral than in an elevator, radio waves bouncing off buildings, walls, and furniture create a unique spatial electromagnetic fingerprint. Even if an imposter sits just a few feet away, the laws of wave physics guarantee that her channel fingerprint is completely different!
🛡️ Physical-Layer Defense Mechanisms
1. Channel State Information (CSI) & Channel Reciprocity
In Time-Division Duplex (TDD) wireless systems, transmission and reception share the same frequency band within the channel's coherence time. By the principle of electromagnetic reciprocity:
- Spatial Decorrelation: If an adversary Eve is separated from Alice or Bob by more than half the carrier wavelength ($\lambda / 2 \approx 6.25\text{ cm}$ for $2.4\text{ GHz}$ Wi-Fi):
$$\mathbb{E}[h_{\text{Alice} \to \text{Bob}} \cdot h_{\text{Eve} \to \text{Bob}}^*] \approx 0$$ - Zero-Overhead Authentication: Bob can instantly authenticate incoming frames by measuring their instantaneous Channel Impulse Response (CIR). If the multipath profile does not match Alice's known trajectory, the frame is rejected before it even reaches the operating system kernel!
2. Cooperative Jamming & Artificial Noise
If Alice has multiple antennas (MIMO) or has friendly helper nodes nearby, she can exploit spatial nulls:
- The Null-Space Strategy: Alice splits her transmit power:
- Portion $1 - \alpha$ transmits the information signal steered directly into Bob's channel eigenvector.
- Portion $\alpha$ transmits Artificial Noise (AN) steered strictly into the null space of Bob's channel ($h_{\text{Bob}} \cdot \mathbf{w}_{\text{noise}} = 0$).
- The Result: Bob experiences zero degradation from the artificial noise because it falls into his blind spot. But to Eve, who sits at a different spatial coordinate, the artificial noise severely degrades her Signal-to-Interference-plus-Noise Ratio (SINR), ensuring $C_M \gg C_W$!
Module 7: Physical-Layer Security vs. Classical Cryptography: The Architectural Duel
💡 Layer 1: The Intuitive Hook — The Mathematical Lock vs. The Laws of Physics
Classical cryptography is like a heavy steel combination lock with a quadrillion combinations. It is secure because no burglar alive can try every combination before the sun expands and swallows the earth. But what happens when someone invents a quantum key-picker (quantum computing) or finds a mathematical flaw that bypasses the tumblers entirely?
Physical-Layer Security is not a lock; it is the atmosphere inside the room. By ensuring that the laws of physics prevent enough signal energy from ever reaching the burglar in the first place, no amount of computing power—not even a computer the size of the universe—can reconstruct what was never captured!
📊 Comprehensive Paradigm Comparison
| Dimension | Classical Computational Security | Physical-Layer Information-Theoretic Security |
|---|---|---|
| Foundational Guarantee | Computational hardness (factoring, discrete log, lattice problems) | Laws of physics, probability, and information theory |
| Adversarial Assumption | Eavesdropper has bounded computational power | Eavesdropper has unlimited computing power & infinite time |
| Quantum Threat | High vulnerability (Shor's algorithm breaks RSA & ECC; Grover weakens AES) | 100% Quantum-Immune (Channel noise cannot be reversed by qubits) |
| Key Distribution | Requires trusted third parties (PKI, Certificate Authorities, Key Distribution Centers) | Autonomous, localized key generation distilled directly from physical channel entropy |
| Protocol Overhead | Heavy mathematical processing (modular exponentiation, point multiplication) | Lightweight linear algebra (parity checks, universal hashing, FFT) |
| Channel Assumption | Assumes underlying channel is error-free (relies on higher layers) | Embraces and exploits channel noise, multipath fading, and interference |
| Primary Limitation | Mathematical conjectures remain unproven ($P \ne NP$) | Sensitive to accurate channel state estimation; rates depend on physical SNR |
🤝 The Modern Synthesis: Layered Defense-in-Depth
Physical-layer security is not designed to replace classical encryption; rather, it provides a foundational, unforgeable physical substrate:
- At Layer 1: PLS uses channel reciprocity and wiretap coding to distill fresh, high-entropy keys on the fly and degrades eavesdropper SNR.
- At Layer 7: Application encryption (AES-256) protects user data from end to end across intermediate untrusted routers.
- The Synergistic Result: An attacker sniffing the airwaves captures only degraded, corrupted ciphertext with zero mutual information!
Module 8: Book Roadmap & Dependency Architecture
Chapter 1 provides the conceptual and historical foundation for the entire discipline of physical-layer security. The remainder of the textbook systematically develops these principles from abstract information theory to practical silicon implementations.
🗺️ The Chapter Dependency Map (Figure 1.5 in Source Text)
+------------------------------------+
| CHAPTER 2 |
| Fundamentals of Information Theory |
+------------------------------------+
|
+--------------------+--------------------+
| |
v v
+---------------------------+ +---------------------------+
| CHAPTER 3 | | CHAPTER 4 |
| Secrecy Capacity | | Secret-Key Capacity |
+---------------------------+ +---------------------------+
| | | |
| +-----------+-----------+ |
| | |
v v v
+---------------+ +---------------+ +---------------+
| CHAPTER 9 | | CHAPTER 5 | | CHAPTER 6 |
|Network-Coding | |Security Limits| | Coding for |
| Security | |Gaussian/Wirel.| | Secrecy |
+---------------+ +---------------+ +---------------+
| |
v v
+---------------+ +---------------+
| CHAPTER 8 | | CHAPTER 7 |
|Secrecy/Jamming| | System |
| Multi-User | | Aspects |
+---------------+ +---------------+
- Chapter 2: Mathematical foundations of entropy, mutual information, and channel capacity.
- Chapters 3 & 4: Theoretical upper bounds for secrecy capacity and secret-key agreement.
- Chapter 5: Extension to realistic continuous Gaussian and fading wireless channels.
- Chapter 6: Practical coding constructions (LDPC, Polar codes, coset coding).
- Chapters 7, 8, 9: Real-world system integration, multi-user cooperative jamming, and network coding.
# Interactive Parameter Playground: Wiretap Secrecy & Key Distillation Explorer
# Adjust channel parameters to inspect secrecy capacity, equivocation, and Maurer advantage inversion
def explore_physical_layer_security(
p_bob: float = 0.15,
p_eve: float = 0.08,
erasure_rate_eve: float = 0.30,
codeword_len: int = 12
):
# Simulates and computes theoretical PLS metrics for given channel error parameters.
# 1. Binary Erasure Wiretap Metrics
prob_eve_all_clean = (1.0 - erasure_rate_eve) ** codeword_len
eve_equivocation = 1.0 - prob_eve_all_clean
# 2. Binary Symmetric Wiretap Channel Capacities (Shannon capacity: 1 - H_b(p))
def binary_entropy(p):
if p <= 0 or p >= 1: return 0.0
return -p * np.log2(p) - (1 - p) * np.log2(1 - p)
cap_bob = 1.0 - binary_entropy(p_bob)
cap_eve = 1.0 - binary_entropy(p_eve)
secrecy_cap_wyner = max(0.0, cap_bob - cap_eve)
# 3. Maurer Advantage Inversion Metrics
p_eve_compounded = p_bob + p_eve - 2 * p_bob * p_eve
advantage_inversion = p_eve_compounded > p_bob
print("=" * 65)
print(" PHYSICAL-LAYER SECURITY INTERACTIVE METRICS REPORT")
print("=" * 65)
print(f"Main Channel (Bob) Flip Prob p_B: {p_bob:.3f} | Capacity C_Bob: {cap_bob:.3f} bits")
print(f"Wiretap Channel (Eve) Flip Prob p_E: {p_eve:.3f} | Capacity C_Eve: {cap_eve:.3f} bits")
print("-" * 65)
print(f"Wyner Secrecy Capacity C_s = [C_B - C_E]+: {secrecy_cap_wyner:.4f} bits/channel use")
if secrecy_cap_wyner == 0:
print(" ⚠️ Warning: Bob's channel is noisier than Eve's! Wyner wiretap code yields C_s = 0.")
else:
print(" ✅ Positive Secrecy Capacity! Direct secure transmission is possible.")
print("-" * 65)
print("MAURER PUBLIC FEEDBACK PROTOCOL EVALUATION:")
print(f" Alice's Error on Secret Bit V: {p_bob:.4f}")
print(f" Eve's Compounded Error on Secret Bit V: {p_eve_compounded:.4f}")
print(f" Advantage Inversion Achieved? {'✅ YES! (Eve is noisier than Alice)' if advantage_inversion else '❌ NO'}")
print(f" Eve Error Excess over Alice: +{p_eve_compounded - p_bob:.4f}")
print("-" * 65)
print(f"PARITY CODING ON BEC (Length n = {codeword_len}, Erasure Rate eps = {erasure_rate_eve:.2f}):")
print(f" Eve Probability of Zero Erasures: {prob_eve_all_clean:.6f}")
print(f" Eve Equivocation H(M | Z^n): {eve_equivocation:.6f} / 1.000000 bits")
print(f" Information Leaked to Eve: {prob_eve_all_clean * 100:.4f}%")
print("=" * 65)
# Run interactive default scenario
explore_physical_layer_security(p_bob=0.18, p_eve=0.06, erasure_rate_eve=0.35, codeword_len=14)
🎯 Problem-Solving Masterclass: Foundational Problems & Deep Pedagogical Solutions
To truly master Physical-Layer Security and Information-Theoretic Cryptography, you must understand both the mathematical bounds and the engineering trade-offs. Below are 5 comprehensive problem sets spanning the entire chapter, followed by hands-on guided coding challenges and applied engineering design.
📝 Problem Set 1: Shannon Perfect Secrecy, Equivocation & The One-Time Pad Catch
Problem 1.1 (Analytical Proof): The Necessity of Key Entropy $H(K) \ge H(M)$
- Statement: In Shannon’s secrecy system over an error-free channel, Alice maps a plaintext message $M$ and a secret key $K$ into a ciphertext $X$. Bob decodes $\hat{M}$ uniquely from $(X, K)$, meaning $H(M \mid X, K) = 0$.
- Using the chain rule of entropy, prove that if perfect secrecy holds ($H(M \mid X) = H(M)$), the key entropy must satisfy:
$$H(K) \ge H(M)$$ - Explain intuitively why data compression (e.g., gzip, Huffman coding) applied to the message prior to encryption cannot circumvent this bound.
- Using the chain rule of entropy, prove that if perfect secrecy holds ($H(M \mid X) = H(M)$), the key entropy must satisfy:
Problem 1.2 (Cryptanalysis): The Mathematics of Crib Dragging on Two-Time Pads
- Statement: An operator mistakenly encrypts two 8-character ASCII messages, $M_1$ and $M_2$, using the exact same One-Time Pad key $K \in \{0, 1\}^{64}$, producing ciphertexts $C_1 = M_1 \oplus K$ and $C_2 = M_2 \oplus K$. Eve intercepts both and computes $S = C_1 \oplus C_2 = M_1 \oplus M_2$.
- In ASCII encoding, the space character
' 'is binary00100000(hex0x20), while uppercase letters'A'–'Z'are0x41–'0x5A'and lowercase letters'a'–'z'are0x61–'0x7A'. Show mathematically what happens when a letter is XORed with a space character. - If the first byte of $S$ is
0x34, and Eve guesses that the first character of $M_2$ was' '(0x20), what was the first character of $M_1$? - Explain step-by-step how the "crib dragging" technique systematically exposes both plaintexts without Eve ever discovering the key $K$.
- In ASCII encoding, the space character
Problem 1.3 (Information Limits): The Pseudo-Random Number Generator (PRNG) Fallacy
- Statement: A commercial VPN software vendor advertises: "Unbreakable military-grade One-Time Pad security for all 4K video streams using our patent-pending 256-bit quantum seed keystream generator."
- Suppose Alice streams a $10\text{ GB}$ file ($L = 8 \times 10^{10}\text{ bits}$) encrypted by XORing with the pseudo-random stream produced by expanding the $s = 256$-bit seed.
- What is the eavesdropper's conditional entropy $H(M \mid X)$?
- How many candidate plaintexts exist from Eve's perspective?
- Compare this with a true One-Time Pad and explain why information-theoretic security has been completely lost.
📝 Problem Set 2: Wyner’s Wiretap Channel & Secrecy Capacity Limits
Problem 2.1 (Closed-Form Derivation): Secrecy Capacity on Binary Symmetric Channels
- Statement: Let Alice transmit binary symbols $X \in \{0, 1\}$ with uniform prior $P(X=0) = P(X=1) = 0.5$.
- Bob's main channel is a Binary Symmetric Channel (BSC) with crossover probability $p_B \in [0, 0.5]$.
- Eve's wiretap channel is a BSC with crossover probability $p_E \in [0, 0.5]$.
- Write down the expressions for the main channel capacity $C_M$ and the wiretap channel capacity $C_W$ in terms of the binary entropy function $h_b(p) = -p \log_2(p) - (1-p) \log_2(1-p)$.
- Give the closed-form equation for the secrecy capacity $C_s$.
- Calculate $C_s$ when $p_B = 0.05$ and $p_E = 0.20$.
- What is $C_s$ if Eve improves her antenna such that $p_E = 0.02$? Can any forward channel coding scheme provide secrecy in this case?
Problem 2.2 (Continuous Channels): AWGN Secrecy Capacity & SNR Disparity
- Statement: Consider an Additive White Gaussian Noise (AWGN) channel where Alice transmits with power $P$. Bob experiences noise power $\sigma_B^2$ (giving $\text{SNR}_B = P / \sigma_B^2$), and Eve experiences noise power $\sigma_E^2$ (giving $\text{SNR}_E = P / \sigma_E^2$). The secrecy capacity is:
$$C_s = \left[ \frac{1}{2} \log_2(1 + \text{SNR}_B) - \frac{1}{2} \log_2(1 + \text{SNR}_E) \right]^+$$- If Bob has $\text{SNR}_B = 15\text{ dB}$ and Eve has $\text{SNR}_E = 6\text{ dB}$, convert both to linear ratios and calculate $C_s$ in bits per channel use.
- If the channel bandwidth is $W = 20\text{ MHz}$, what is the maximum achievable secret transmission rate in Megabits per second (Mbps)?
📝 Problem Set 3: Coding for Secrecy on the Binary Erasure Channel
Problem 3.1 (Code Dimensioning): Strict Secrecy Threshold on BEC Wiretap Channels
- Statement: Alice transmits confidential bits to Bob over an error-free channel. Eve observes the transmission over a Binary Erasure Channel (BEC) with erasure probability $\epsilon = 0.20$. Alice protects each 1-bit message using an $n$-bit parity code.
- Derive the minimum integer codeword length $n$ required to guarantee that the information leaked to Eve is strictly less than $10^{-6}$ ($0.0001\%$).
- At this value of $n$, what is the code rate $R = 1/n$?
- If $\epsilon$ drops to $0.05$ (Eve's receiver improves significantly), what new codeword length $n$ is required?
Problem 3.2 (Advanced Architectural Design): The Rate Collapse Paradox & Coset Coding
- Statement: A student notes: "In the parity code, as we make $n \to \infty$ to drive Eve's leakage to zero, the communication rate $R = 1/n$ goes to zero! Does physical-layer security inherently force zero transmission rate?"
- Explain why the simple single-parity code exhibits this rate collapse.
- Explain how coset coding (using linear block codes such as LDPC or Polar codes with generator matrix $\mathbf{G}$ and parity-check matrix $\mathbf{H}$) allows Alice and Bob to achieve positive secrecy rate $R = C_s > 0$ while simultaneously blinding Eve.
📝 Problem Set 4: Maurer's Secret-Key Agreement & Advantage Inversion
Problem 4.1 (Mathematical Anatomy): The Proof of Advantage Inversion
- Statement: In Maurer's model, Alice sends random bit $X \in \{0, 1\}$. Bob receives $Y = X \oplus D$ with $D \sim \text{Bern}(p_B)$. Eve receives $Z = X \oplus E$ with $E \sim \text{Bern}(p_E)$. Bob broadcasts public feedback $F = V \oplus Y$, where $V \sim \text{Bern}(0.5)$ is Bob's private secret bit.
- Alice computes $\hat{V}_A = F \oplus X = V \oplus D$.
- Eve computes $\hat{V}_E = F \oplus Z = V \oplus D \oplus E$.
- Prove algebraically that the error probability for Eve is:
$$P(\hat{V}_E \ne V) = p_B + p_E - 2p_B p_E$$ - Prove that for any $0 < p_B < 0.5$ and $0 < p_E < 0.5$, $P(\hat{V}_E \ne V) > p_B$, regardless of whether $p_B > p_E$ or $p_B < p_E$.
- Calculate Eve's compounded error rate when Bob's raw channel is very noisy ($p_B = 0.25$) and Eve's raw channel is nearly pristine ($p_E = 0.04$).
Problem 4.2 (Quantitative System Budget): Sizing the 3-Phase Key Distillation Pipeline
- Statement: Alice and Bob collect $N = 1,000,000$ correlated raw bits using a wireless link where $p_B = 0.14$ and $p_E = 0.05$. They run Maurer's public discussion protocol.
- Compute Eve's effective error rate $p_{\text{comp}}$ after public feedback.
- Compute the secret-key capacity rate $C_K = h_b(p_{\text{comp}}) - h_b(p_B)$ in bits per raw symbol.
- Phase 2 (Information Reconciliation): Using Slepian-Wolf coding with realistic modern practical efficiency $f = 1.15$, how many parity/syndrome bits $m_{\text{leak}} = f \cdot N \cdot h_b(p_B)$ must Alice disclose publicly to Bob to correct all bit errors?
- Phase 3 (Privacy Amplification): Using the Leftover Hash Lemma with security parameter $s = 64$ bits (ensuring information leakage $\le 2^{-64}$), calculate the final size $\ell$ of the pristine secret key.
📝 Problem Set 5: Physical Countermeasures: Reciprocity & Cooperative Jamming
Problem 5.1 (Wave Physics): Spatial Multipath Decorrelation & CIR Spoofing
- Statement: In a $5.8\text{ GHz}$ industrial IoT deployment ($\lambda = c/f = 5.17\text{ cm}$), Alice and Bob authenticate frames using Channel Impulse Response (CIR) reciprocity in TDD mode. An active attacker, Eve, positions an impersonation antenna $20\text{ cm}$ away from Alice.
- In terms of carrier wavelength $\lambda$, how far is Eve from Alice?
- According to Clarke's 2D isotropic scattering model, the spatial correlation between channels separated by distance $d$ follows the zero-order Bessel function:
$$\rho(d) = J_0\left(\frac{2\pi d}{\lambda}\right)$$
Given that $J_0(x) \approx 0$ for $x \approx 2.405, 5.52, 8.65$, explain why Bob can detect Eve's impersonation attempt with near 100% certainty. - Why would this physical authentication fail if the system operated in Frequency-Division Duplex (FDD) mode?
Problem 5.2 (MIMO Linear Algebra): Cooperative Jamming & Artificial Noise Beamforming
- Statement: A base station Alice is equipped with $N_t = 4$ transmit antennas. The legitimate receiver Bob has $N_r = 1$ antenna (channel vector $\mathbf{h}_B \in \mathbb{C}^{1 \times 4}$), and an eavesdropper Eve has 1 antenna (channel vector $\mathbf{h}_E \in \mathbb{C}^{1 \times 4}$).
- Alice constructs her transmit vector as:
$$\mathbf{x} = \mathbf{w} s + \mathbf{v}$$
Where $s \in \mathbb{C}$ is the data symbol, $\mathbf{w} \in \mathbb{C}^{4 \times 1}$ is the matched filter beamformer $\mathbf{w} = \mathbf{h}_B^H / \|\mathbf{h}_B\|$, and $\mathbf{v} \in \mathbb{C}^{4 \times 1}$ is the Artificial Noise vector.
- What exact linear algebraic condition must the artificial noise vector $\mathbf{v}$ satisfy with respect to $\mathbf{h}_B$?
- How does Alice generate $\mathbf{v}$ using the projection matrix of the null space of $\mathbf{h}_B$?
- Show mathematically why Bob receives zero interference from $\mathbf{v}$, while Eve experiences severe degradation.
- Alice constructs her transmit vector as:
💻 Guided Implementation & Automated Assertions (Tier 2)
# Tier 2 Guided Implementation & Automated Assertions
# Comprehensive simulation testing both Binary Erasure Parity Coding and Maurer Advantage Inversion
def simulate_binary_erasure_parity_trial(
message_bit: int,
codeword_length: int,
erasure_prob: float,
seed: int = None
) -> dict:
# Simulates transmission of a 1-bit message over an error-free Bob channel
# and a BEC Eve channel using an n-bit parity code.
if seed is not None:
np.random.seed(seed)
assert message_bit in (0, 1), "Message bit must be 0 or 1"
assert codeword_length >= 2, "Codeword length must be at least 2"
assert 0.0 <= erasure_prob <= 1.0, "Erasure probability must be in [0, 1]"
# 1. Generate first n-1 random bits
random_bits = np.random.randint(0, 2, size=codeword_length - 1)
# 2. Compute parity bit such that sum(codeword) % 2 == message_bit
current_parity = np.sum(random_bits) % 2
parity_bit = (message_bit ^ current_parity)
codeword = np.append(random_bits, parity_bit).tolist()
# 3. Bob decodes over error-free channel
bob_decoded = int(np.sum(codeword) % 2)
# 4. Eve observes over BEC
eve_received = []
erasure_count = 0
for bit in codeword:
if np.random.rand() < erasure_prob:
eve_received.append('?')
erasure_count += 1
else:
eve_received.append(str(bit))
perfect_secrecy_achieved = (erasure_count >= 1)
return {
'codeword': codeword,
'bob_decoded': bob_decoded,
'eve_received': eve_received,
'eve_erasure_count': erasure_count,
'perfect_secrecy_achieved': perfect_secrecy_achieved
}
def simulate_maurer_feedback_trial(
num_bits: int,
p_bob: float,
p_eve: float,
seed: int = None
) -> dict:
# Simulates Maurer's advantage inversion protocol over num_bits
if seed is not None:
np.random.seed(seed)
# Alice sends X
X = np.random.randint(0, 2, size=num_bits)
# Channel noise
D = (np.random.rand(num_bits) < p_bob).astype(int)
E = (np.random.rand(num_bits) < p_eve).astype(int)
# Observations
Y = X ^ D
Z = X ^ E
# Bob generates private secret bit V and sends public feedback F = V ^ Y
V = np.random.randint(0, 2, size=num_bits)
F = V ^ Y
# Alice recovers V_hat_A = F ^ X = V ^ D
V_hat_alice = F ^ X
# Eve estimates V_hat_E = F ^ Z = V ^ D ^ E
V_hat_eve = F ^ Z
alice_errors = np.mean(V_hat_alice != V)
eve_errors = np.mean(V_hat_eve != V)
return {
'alice_error_rate': float(alice_errors),
'eve_error_rate': float(eve_errors),
'theoretical_eve_error': float(p_bob + p_eve - 2 * p_bob * p_eve),
'advantage_inverted': bool(eve_errors > alice_errors)
}
# =====================================================================
# AUTOMATED VALIDATION HARNESS (Zero-Error Test Suite)
# =====================================================================
print("Running automated validation assertions for Practice Suite...")
# Test 1: Parity Code Bob Decodability & Parity Integrity
for m in [0, 1]:
res = simulate_binary_erasure_parity_trial(message_bit=m, codeword_length=12, erasure_prob=0.3, seed=123)
assert res['bob_decoded'] == m, f"Bob decoding error: expected {m}, got {res['bob_decoded']}"
assert sum(res['codeword']) % 2 == m, "Codeword parity does not match message!"
# Test 2: Monte Carlo verification of theoretical bound H(M|Z^n) >= 1 - (1-eps)^n
mc_trials = 2500
codeword_n = 6
eps = 0.25
empirical_protected = sum(
simulate_binary_erasure_parity_trial(np.random.randint(0, 2), codeword_n, eps)['perfect_secrecy_achieved']
for _ in range(mc_trials)
)
empirical_rate = empirical_protected / mc_trials
theoretical_rate = 1.0 - (1.0 - eps)**codeword_n
print(f"Parity Monte Carlo Secrecy Rate: {empirical_rate:.4f} (Theory: {theoretical_rate:.4f})")
assert abs(empirical_rate - theoretical_rate) < 0.03, "Monte Carlo deviated from theory!"
# Test 3: Maurer Advantage Inversion Verification (Bob worse than Eve)
p_b, p_e = 0.20, 0.06
res_m = simulate_maurer_feedback_trial(num_bits=20000, p_bob=p_b, p_eve=p_e, seed=99)
print(f"Maurer Test: Alice Error = {res_m['alice_error_rate']:.4f} (Target: {p_b:.4f})")
print(f"Maurer Test: Eve Error = {res_m['eve_error_rate']:.4f} (Theory: {res_m['theoretical_eve_error']:.4f})")
assert res_m['advantage_inverted'] is True, "Advantage inversion failed!"
assert abs(res_m['alice_error_rate'] - p_b) < 0.015, "Alice error rate mismatch!"
assert abs(res_m['eve_error_rate'] - res_m['theoretical_eve_error']) < 0.015, "Eve error rate mismatch!"
print("✅ All Tier 2 assertions passed successfully with zero errors!")
🔬 Tier 3: Applied System Engineering Challenge & Distillation Ledger
Designing a Satellite-to-Ground Physical-Layer Key Generation Budget
Scenario:
A Low Earth Orbit (LEO) scientific satellite passes over a university ground station (Bob) for a 6-minute window. An adversary (Eve) operates a rogue tracking dish 5 km outside the university campus.
- Alice (satellite) transmits beacon pulses at $10\text{ MHz}$ ($10^7\text{ pulses/second}$).
- Due to atmospheric turbulence and receiver hardware, the binary observation error rates are:
- Bob's error rate: $p_B = 0.12$
- Eve's error rate: $p_E = 0.05$ (Eve has a higher-gain dish!)
- Alice and Bob run Maurer's public discussion protocol to distill a secret key.
Engineering Tasks:
- Calculate Eve's compounded error rate $P(\text{Eve Error})$ after Bob's public feedback.
- If Alice and Bob collect $N = 100,000$ correlated raw bits, calculate the theoretical secret key capacity $C_K = I(X;Y) - I(X;Z)$ available from these samples.
- Compute the maximum length of the pristine secret key after information reconciliation and privacy amplification.
📖 Comprehensive Solutions Masterclass (Step-by-Step Pedagogical Rationales)
🔍 Click to Expand Solutions for Problem Set 1 (Shannon Secrecy & One-Time Pad)
Solution to Problem 1.1: Information-Theoretic Proof of $H(K) \ge H(M)$
1. Step-by-Step Mathematical Derivation:
- Consider the joint entropy of message $M$, key $K$, and ciphertext $X$:
$$H(M, X, K) = H(X, K) + H(M \mid X, K)$$ - Since Bob can uniquely recover the message $M$ from $X$ and $K$ without error:
$$H(M \mid X, K) = 0 \implies H(M, X, K) = H(X, K)$$ - Expanding $H(M, X, K)$ in the reverse order:
$$H(M, X, K) = H(M, K) + H(X \mid M, K)$$ - Since ciphertext $X$ is a deterministic function of message $M$ and key $K$ ($X = f(M, K)$):
$$H(X \mid M, K) = 0 \implies H(M, X, K) = H(M, K)$$ - Furthermore, the key $K$ is generated completely independently of the plaintext message $M$, so:
$$H(M, K) = H(M) + H(K)$$ - Equating the two expressions for $H(M, X, K)$:
$$H(X, K) = H(M) + H(K)$$ - Now consider the joint entropy $H(M, X)$:
$$H(M, X) = H(X) + H(M \mid X)$$ - Under Shannon's Perfect Secrecy Condition, $H(M \mid X) = H(M)$:
$$H(M, X) = H(X) + H(M)$$ - Since conditioning cannot increase entropy ($H(M, X) \le H(M, X, K) = H(X, K)$) and $H(X, K) \le H(X) + H(K)$:
$$H(X) + H(M) \le H(X) + H(K) \implies \boxed{H(K) \ge H(M)}$$
2. The Physical Intuition ("Why It Works"):
Every bit of plaintext represents a degree of freedom. If the key has fewer degrees of freedom than the message ($H(K) < H(M)$), then by the Pigeonhole Principle, multiple messages must share the same ciphertext-key combinations. When Eve intercepts $X$, some plaintexts become impossible, giving Eve non-zero mutual information.
3. Common Traps & Misconceptions:
- Misconception: "Can we compress the message with gzip to reduce $H(M)$?"
- Correction: Compression reduces the string length $L$, but it increases the entropy density per bit toward $1.0$. The total Shannon entropy $H(M)$ is an intrinsic property of the underlying information source. Shannon's bound strictly dictates that the key entropy must match or exceed the true entropy of the underlying message.
Solution to Problem 1.2: The Mathematics of Crib Dragging
1. Step-by-Step Derivation:
- In ASCII, lowercase letters differ from uppercase letters by exactly bit 5 (
0x20):'A'=0x41(0100 0001),' '=0x20(0010 0000).'A' ^ ' '=0x41 ^ 0x20 = 0x61='a'.- Rule: XORing any English letter with a space character toggles its case!
- Given $S[0] = 0x34$ and guessing $M_2[0] = \text{' '} = 0x20$:
$$M_1[0] = S[0] \oplus M_2[0] = 0x34 \oplus 0x20 = 0x14 \implies \text{Control character DC4}$$
(Since this is not a printable letter, Eve knows that character was NOT a space!) - If Eve guesses $M_2[0] = \text{'T'} = 0x54$:
$$M_1[0] = 0x34 \oplus 0x54 = 0x60 \implies \text{grave accent '`'}$$ - If Eve guesses $M_1[0] = \text{'C'} = 0x43$:
$$M_2[0] = 0x34 \oplus 0x43 = 0x77 = \text{'w'}$$
Both'C'and'w'are valid printable characters! Eve drags common crib words ("THE","AND","HTTP") across $S = C_1 \oplus C_2$. Whenever a crib produces readable English text in the parallel stream, both plaintexts are unmasked simultaneously.
Solution to Problem 1.3: The PRNG Seed Fallacy
1. Step-by-Step Derivation:
- A PRNG is a deterministic mapping $G: \{0, 1\}^s \to \{0, 1\}^L$, where $s = 256$ and $L = 8 \times 10^{10}\text{ bits}$.
- Even though the output string is $10\text{ GB}$ long, there are at most $2^{256}$ distinct keystreams that $G$ can ever produce!
- By the fundamental property of entropy:
$$H(\text{Keystream}) \le H(\text{Seed}) = 256\text{ bits}$$ - Since the ciphertext is $X = M \oplus G(\text{Seed})$, observing $X$ confines the message $M$ to at most $2^{256}$ possibilities out of $2^L$:
$$H(M \mid X) \le 256\text{ bits} \ll 8 \times 10^{10}\text{ bits}$$ - Result: Eve does not need to search $2^{8 \times 10^{10}}$ plaintexts; she only needs to search $2^{256}$ seeds. Information-theoretic security has collapsed to computational security.
🔍 Click to Expand Solutions for Problem Set 2 (Wyner Secrecy Capacity)
Solution to Problem 2.1: Binary Symmetric Wiretap Channel Capacity
1. Derivation:
- For a BSC with error probability $p$, Shannon capacity is $C = 1 - h_b(p)$.
- Therefore:
- Main channel capacity: $C_M = 1 - h_b(p_B)$
- Wiretap channel capacity: $C_W = 1 - h_b(p_E)$
- Wyner's secrecy capacity:
$$C_s = [C_M - C_W]^+ = [ (1 - h_b(p_B)) - (1 - h_b(p_E)) ]^+ = \boxed{[h_b(p_E) - h_b(p_B)]^+}$$
2. Numerical Evaluation ($p_B = 0.05, p_E = 0.20$):
- $h_b(0.05) = -0.05\log_2(0.05) - 0.95\log_2(0.95) \approx 0.2864\text{ bits}$
- $h_b(0.20) = -0.20\log_2(0.20) - 0.80\log_2(0.80) \approx 0.7219\text{ bits}$
- Secrecy capacity:
$$C_s = 0.7219 - 0.2864 = \mathbf{0.4355\text{ bits per channel use}}$$ - Alice can transmit at up to $0.4355$ bits per symbol with 100% secrecy and 0% error at Bob!
3. What if $p_E = 0.02$?
- $h_b(0.02) = 0.1414\text{ bits}$.
- Since $p_E < p_B \implies h_b(p_E) < h_b(p_B)$:
$$C_s = [0.1414 - 0.2864]^+ = \mathbf{0.0000}$$ - Without feedback, forward wiretap coding cannot provide information-theoretic secrecy!
Solution to Problem 2.2: AWGN Wiretap Secrecy Capacity
1. Conversion to Linear SNR:
- $\text{SNR}_B = 10^{15 / 10} = 10^{1.5} \approx 31.6228$
- $\text{SNR}_E = 10^{6 / 10} = 10^{0.6} \approx 3.9811$
- Main channel capacity: $C_M = \frac{1}{2} \log_2(1 + 31.6228) = \frac{1}{2} \log_2(32.6228) \approx 2.5139\text{ bits/sample}$
- Wiretap channel capacity: $C_W = \frac{1}{2} \log_2(1 + 3.9811) = \frac{1}{2} \log_2(4.9811) \approx 1.1583\text{ bits/sample}$
- Secrecy capacity:
$$C_s = 2.5139 - 1.1583 = \mathbf{1.3556\text{ bits/channel use}}$$
2. Secret Throughput at $W = 20\text{ MHz}$ (Nyquist rate $20\text{ MSamples/sec}$):
🔍 Click to Expand Solutions for Problem Set 3 (BEC Parity Coding)
Solution to Problem 3.1: Codeword Dimensioning on BEC
1. Analytical Solution:
- Eve learns the message if and only if she receives all $n$ bits with zero erasures:
$$P(\text{Zero Erasures}) = (1 - \epsilon)^n$$ - We require:
$$(1 - \epsilon)^n < 10^{-6}$$ - Taking the natural logarithm on both sides:
$$n \ln(1 - \epsilon) < \ln(10^{-6}) = -6 \ln(10) \approx -13.8155$$ - Since $\ln(1 - \epsilon) < 0$, dividing by $\ln(1 - \epsilon)$ flips the inequality:
$$n > \frac{-13.8155}{\ln(1 - \epsilon)}$$ - For $\epsilon = 0.20$: $\ln(0.80) \approx -0.22314$:
$$n > \frac{-13.8155}{-0.22314} \approx 61.91 \implies \mathbf{n = 62\text{ bits}}$$ - At $n = 62$, code rate is $R = 1/62 \approx 0.0161$ bits/symbol.
- If $\epsilon = 0.05$: $\ln(0.95) \approx -0.05129$:
$$n > \frac{-13.8155}{-0.05129} \approx 269.34 \implies \mathbf{n = 270\text{ bits}}$$
Solution to Problem 3.2: Coset Coding vs. Rate Collapse
- In simple parity coding, we map 1 message bit to $n$ transmitted bits $\implies R = 1/n \to 0$.
- The Coset Coding Solution:
- Alice chooses an $[n, k]$ linear block code $C$ with parity-check matrix $\mathbf{H} \in \{0, 1\}^{(n-k) \times n}$.
- The message $M$ of length $k_{\text{sec}} = n - k$ bits is identified with a syndrome $\mathbf{s} = M$.
- The vector space $\mathbb{F}_2^n$ is partitioned into $2^{n-k}$ disjoint cosets, each corresponding to a unique syndrome.
- To transmit message $M$, Alice chooses a codeword $X^n$ uniformly at random from the coset associated with syndrome $M$:
$$\mathbf{H} X^n = M$$ - Bob uses standard decoding to identify the coset and recovers $M$.
- Eve's channel noise erases enough bits that her conditional distribution across all cosets becomes uniform, blinding her completely while achieving rate $R = (n-k)/n = C_s > 0$!
🔍 Click to Expand Solutions for Problem Set 4 (Maurer Advantage Inversion)
Solution to Problem 4.1: Mathematical Proof of Advantage Inversion
1. Algebraic Derivation:
- Eve's estimate is $\hat{V}_E = V \oplus D \oplus E$.
- Eve makes an error when $D \oplus E = 1$.
- By independence of noise variables $D \sim \text{Bern}(p_B)$ and $E \sim \text{Bern}(p_E)$:
$$P(D \oplus E = 1) = P(D=1, E=0) + P(D=0, E=1) = p_B(1 - p_E) + (1 - p_B)p_E = p_B + p_E - 2p_B p_E$$ - To prove that this error is strictly greater than Bob's error $p_B$:
$$P(D \oplus E = 1) - p_B = (p_B + p_E - 2p_B p_E) - p_B = p_E(1 - 2p_B)$$ - Since $0 < p_B < 0.5$, we have $1 - 2p_B > 0$. Since $p_E > 0$, the product is strictly positive:
$$\boxed{P(\text{Eve Error}) > p_B = P(\text{Alice Error})}$$
2. Numeric Evaluation ($p_B = 0.25, p_E = 0.04$):
Eve's effective error rate is $27\%$, which is strictly worse than Alice's $25\%$, even though Eve's raw antenna was over 6 times cleaner!
Solution to Problem 4.2: Sizing Key Distillation Pipeline
import numpy as np
p_b = 0.14
p_e = 0.05
N = 1000000
# 1. Compounded error
p_comp = p_b + p_e - 2 * p_b * p_e # 0.14 + 0.05 - 0.014 = 0.1760
def h_b(p):
return -p * np.log2(p) - (1 - p) * np.log2(1 - p)
H_alice = h_b(p_b) # h_b(0.14) = 0.5842
H_eve = h_b(p_comp) # h_b(0.176) = 0.6706
# 2. Secret Key Rate
C_K = H_eve - H_alice # 0.0864 bits/symbol
# 3. Information Reconciliation Leakage
f = 1.15
m_leak = int(f * N * H_alice) # 1.15 * 10^6 * 0.5842 = 671,830 bits
# 4. Final Secret Key Size (Privacy Amplification)
# Squeezing out Eve's mutual information and reconciliation leakage:
ell = int(N * C_K - 2 * 64)
print(f"Final Secret Key Length: {ell} bits ({ell // 8} bytes)")
# Output: ~86,272 bits (~10.78 KB of 100% secure One-Time Pad key!)
🔍 Click to Expand Solutions for Problem Set 5 (Physical Countermeasures)
Solution to Problem 5.1: Spatial Decorrelation & CIR Spoofing
1. Distance in Carrier Wavelengths:
- $f = 5.8\text{ GHz} \implies \lambda = 5.17\text{ cm}$.
- Distance $d = 20\text{ cm} \implies d/\lambda = 20 / 5.17 \approx 3.87\lambda$.
- Since $d \gg \lambda/2 \approx 2.58\text{ cm}$, the spatial correlation $\rho(d) = J_0(2\pi \cdot 3.87) = J_0(24.3) \approx 0.02$.
- Authentication Verdict: The multipath channel impulse response between Eve and Bob has virtually zero correlation with Alice and Bob's channel. Bob measures the Channel State Information (CSI) matrix; since it fails the cross-correlation threshold ($< 0.1$), Eve's spoofed packet is instantly discarded.
2. Why FDD Fails:
In FDD, downlink and uplink operate on carrier frequencies separated by tens of megahertz ($f_{\text{DL}} \ne f_{\text{UL}}$). Because multipath interference depends on the exact phase $e^{-j 2\pi f \tau_i}$ of each path delay $\tau_i$, channel impulse responses decorrelate across frequencies. Instantaneous reciprocity is lost unless sophisticated parametric channel reconstruction is employed.
Solution to Problem 5.2: Artificial Noise Beamforming Null-Space Math
1. Algebraic Null-Space Condition:
Alice must design the artificial noise vector $\mathbf{v}$ such that it lies in the null space of Bob's channel vector $\mathbf{h}_B$:
2. Projection Matrix Generation:
- Alice constructs the orthogonal projector onto the null space of $\mathbf{h}_B$:
$$\mathbf{P}_{\mathbf{h}_B}^{\perp} = \mathbf{I}_{N_t} - \mathbf{h}_B^H (\mathbf{h}_B \mathbf{h}_B^H)^{-1} \mathbf{h}_B$$ - Alice generates an independent complex Gaussian noise vector $\mathbf{u} \sim \mathcal{CN}(0, \sigma_v^2 \mathbf{I})$ and projects it:
$$\mathbf{v} = \mathbf{P}_{\mathbf{h}_B}^{\perp} \mathbf{u}$$
3. Why Bob is Unaffected While Eve is Jammed:
- Bob receives:
$$y_B = \mathbf{h}_B \mathbf{x} + n_B = \mathbf{h}_B (\mathbf{w} s + \mathbf{v}) + n_B = \mathbf{h}_B \mathbf{w} s + \underbrace{\mathbf{h}_B \mathbf{v}}_{= 0} + n_B = \|\mathbf{h}_B\| s + n_B$$
Bob's SINR is completely uncorrupted by the artificial noise! - Eve receives:
$$y_E = \mathbf{h}_E \mathbf{x} + n_E = \mathbf{h}_E \mathbf{w} s + \mathbf{h}_E \mathbf{v} + n_E$$
Because Eve sits at a different spatial angle, $\mathbf{h}_E$ is linearly independent of $\mathbf{h}_B$, so $\mathbf{h}_E \mathbf{v} \ne 0$. Eve's effective SINR is:
$$\text{SINR}_E = \frac{|\mathbf{h}_E \mathbf{w}|^2 P_s}{\mathbb{E}[|\mathbf{h}_E \mathbf{v}|^2] + \sigma_E^2} \ll \text{SNR}_B$$
Eve is blinded by artificial noise that Bob cannot even hear!
Summary, Takeaways & Formal Academic References
📌 Core Takeaways
- The Physical Layer is Not Just Plumbing: Instead of treating channel noise as an error-correction burden, physical-layer security transforms stochastic noise into an unforgeable cryptographic asset.
- Shannon's Pessimism Overturned: Shannon's requirement that $H(K) \ge H(M)$ applies strictly to error-free wires. When physical channels are noisy and independent, Wyner wiretap codes and Maurer key agreement permit secure communication with zero pre-shared keys.
- Decoupling Reliability from Secrecy: Maurer’s 3-phase pipeline (Advantage Distillation $\to$ Information Reconciliation $\to$ Privacy Amplification) allows engineers to handle error correction and privacy separately, making practical deployment feasible.
- Defense-in-Depth: PLS provides a quantum-immune, decentralized physical substrate that complements classical higher-layer ciphers (AES-256, TLS).
📚 Formal Academic References & Authoritative Literature
- Shannon, C. E. (1949). Communication theory of secrecy systems. Bell System Technical Journal, 28(4), 656–715.
- The foundational treatise establishing mathematical cryptography, entropy-based secrecy, the equivocation metric, and the proof of the One-Time Pad bound.
- Wyner, A. D. (1975). The wire-tap channel. Bell System Technical Journal, 54(8), 1355–1387.
- Seminal paper introducing the degraded wiretap channel model, equivocation rate, and proving the existence of positive secrecy capacity without pre-shared keys.
- Diffie, W., & Hellman, M. E. (1976). New directions in cryptography. IEEE Transactions on Information Theory, 22(6), 644–654.
- The watershed paper introducing public-key cryptography and computational hardness, which historically shifted cryptographic research away from information theory.
- Maurer, U. M. (1993). Secret key agreement by public discussion from common information. IEEE Transactions on Information Theory, 39(3), 733–742.
- Landmark paper demonstrating that public feedback allows Alice and Bob to distill secret keys even when the eavesdropper has a superior physical channel.
- Ahlswede, R., & Csiszár, I. (1993). Common randomness in information theory and cryptography—Part I: Secret sharing. IEEE Transactions on Information Theory, 39(4), 1121–1132.
- Foundational companion work defining secret-key capacity and source-channel models of key agreement under public discussion.
- Csiszár, I., & Körner, J. (1978). Broadcast channels with confidential messages. IEEE Transactions on Information Theory, 24(3), 339–348.
- Generalized Wyner's wiretap channel to non-degraded broadcast channels, establishing the canonical formula $C_s = \max [I(X;Y) - I(X;Z)]$.
- Bennett, C. H., Brassard, G., & Robert, J. M. (1988). Privacy amplification by public discussion. SIAM Journal on Computing, 17(2), 210–229.
- Pioneered the mathematical theory of privacy amplification using 2-universal hash functions to extract secret bits from partially compromised strings.
- Bloch, M., & Barros, J. (2011). Physical-Layer Security: From Information Theory to Security Engineering. Cambridge University Press.
- The premier textbook providing comprehensive theoretical foundations, code designs (LDPC/Polar), and system engineering architectures for physical-layer security.