Section II: Cryptographic Primitives
April 9, 2026
1 if exactly one of its inputs is 1; otherwise 0.
⊕, ^, or sometimes XOR.Truth Table:
| A | B | A ⊕ B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Properties:
A ⊕ B = B ⊕ A(A ⊕ B) ⊕ C = A ⊕ (B ⊕ C)A ⊕ 0 = AA ⊕ A = 0Visualization: Think of a “difference detector” — it lights up when inputs differ.
Imagine you and a friend share a secret, infinite-length pad of random text
Could establish perfect secrecy if you never reused the same offset into pad
Test XOR with a OTP here: XOR Pad Demo
Let \(h\) be a cryptographic hash function
\(h : \{0,1\}^* \to \{0,1\}^n\)
Let the initial seed be \(s_0 \in \{0,1\}^n\)
For each round \(i = 1, 2, \dots, t\):
Final output: \(y_1 \,\|\, y_2 \,\|\, \dots \,\|\, y_t\)
Visualize this: PRG Demo
Interpretation: Each iteration hashes the current seed, emits one byte as pseudorandom output, and reuses the rest as the next seed. However, this structure is not provably secure.
Interpretation: Use a secret key \(K\) and a public counter to “seek” through a PRF. Each \(B_i\) is pseudorandom; selecting a byte (or more) per round yields a secure keystream.
| Principle | Purpose | Example |
|---|---|---|
| Confusion | Obscure the relationship between key and ciphertext. | Substitution tables (S-boxes) |
| Diffusion | Spread the influence of each plaintext bit across many ciphertext bits. | Permutation layers (P-boxes) |
| Feature | Block Cipher | Stream Cipher |
|---|---|---|
| Unit of operation | Fixed-size blocks (e.g., 128 bits) | Single bits or bytes |
| Key use | Same key for many rounds | Key generates continuous keystream |
| Examples | AES, DES | ChaCha20, RC4 |
| Strength | Strong diffusion and structure | High speed and low latency |
| Typical use | Disk, file encryption | Real-time communication, VPNs |
Photo Credit: A.M. Rowsell and Epachamo, CC-BY-SA 4.0. Wikipedia
| Mode | Description | Strengths | Weaknesses |
|---|---|---|---|
| ECB | Encrypts each block independently. | Simple, parallelizable. | Reveals patterns (insecure). |
| CBC | Chains each block to the previous via XOR with IV. | Hides patterns, strong diffusion. | Sequential; needs IV. |
| CFB | Turns block cipher into self-synchronizing stream. | Handles short data streams. | Bit errors propagate. |
| CTR | Encrypts counter values to generate keystream. | Parallelizable, random access. | Requires unique nonce. |
Photo Credit: Larry Ewing. Wikipedia
HELLO\x03\x03\x03 for 8-byte block.Confidentiality hides contents; integrity detects tampering; authenticity binds to a key holder.
AEAD schemes provide both confidentiality and integrity in one API.
Associated Data (AAD): authenticated but unencrypted headers/metadata.
Examples: AES-GCM, ChaCha20-Poly1305; older pattern: Encrypt-then-MAC with HMAC.

Symmetric Encryption — Army Cyber Institute — April 9, 2026