pk.org: Computer Security/Lecture Notes

Symmetric Cryptography

Terms you should know

Paul Krzyzanowski – 2026-09-14

Goals and Terms

Cryptography
The practice of designing systems for secure communication in the presence of adversaries.
Cryptanalysis
Breaking cryptographic systems by recovering the message or key without being given the key.
Cryptology
The study of both cryptography and cryptanalysis.
Confidentiality
Keeping the contents of a message hidden from unauthorized readers.
Authentication
Verifying the origin of a message or the identity of a party.
Integrity
Ensuring that a message has not been modified.
Non-repudiation
Preventing a sender from later denying that they sent a message.
Plaintext
The original, readable message.
Ciphertext
The encrypted form of a message.
Encryption
Transforming plaintext into ciphertext.
Decryption
Recovering plaintext from ciphertext.
Cipher
The algorithm that transforms plaintext into ciphertext and back.
Key
The secret value that controls how a cipher transforms data.
Cryptosystem
A cipher together with its keys and the procedures for using them.
Symmetric encryption
Encryption in which the same key encrypts and decrypts.
Asymmetric encryption
Encryption in which different keys encrypt and decrypt.
Keyspace
The set of all possible keys for a cipher.
Brute-force attack
Trying every key until one produces readable plaintext.
Kerckhoffs’s Principle
A cryptosystem must remain secure when everything but the key is known.
Schneier’s Law
Anyone can design a cipher that they themselves cannot break.

Classical Ciphers

Classical cipher
A cipher designed to be operated by hand, before the twentieth century.
Substitution cipher
A cipher that replaces each symbol with another symbol.
Transposition cipher
A cipher that keeps the symbols but rearranges their order.
Caesar cipher
A substitution cipher that shifts every letter by a fixed amount.
Monoalphabetic substitution cipher
A cipher that maps each plaintext letter to one fixed ciphertext letter.
Bigram
A pair of adjacent letters, also called a digram.
Trigram
A sequence of three adjacent letters.
Frequency analysis
Breaking a cipher by matching symbol frequencies to a language’s letter frequencies.
Polyalphabetic cipher
A substitution cipher that changes its alphabet as it moves through the message.
Vigenère cipher
A polyalphabetic cipher in which a repeating keyword selects the shift for each letter.
Keystream
The sequence of key values applied one by one to successive units of plaintext.
Period
The number of letters before a keystream repeats.
Keyword
A repeated word whose letters select successive substitutions.
Kasiski attack
Finding a Vigenère keyword’s length from the distances between repeated ciphertext.
Columnar transposition
Writing a message in rows and reading the columns in keyword order.
Padding
Filler added so that a message fits a required size.
Playfair cipher
A nineteenth-century cipher that substituted pairs of letters instead of single letters.
ADFGVX cipher
A World War I German cipher that applied substitution and then transposition.

Rotor Machines

Rotor
A disk wired to perform a fixed substitution that changes as it turns.
Rotor machine
A cipher machine whose stacked rotors change the substitution with every letter.
Enigma
The German rotor machine of World War II, broken through its structural and procedural flaws.
Message key
The rotor starting positions chosen by an Enigma operator for one message.
Crib
A stretch of plaintext that an analyst can guess for a given ciphertext.
Bombe
The electromechanical machine that searched for Enigma settings consistent with a crib.
Stop
A bombe halt at a setting that produced no contradiction.
Traffic analysis
Learning who is communicating, when, and how much without reading the messages.
Stream cipher
A cipher that XORs the message with a generated sequence of key bits.

Information Theory and Perfect Secrecy

Entropy
The uncertainty in a random variable, measured in bits.
Redundancy
The portion of a message that a reader could have predicted.
Perfect secrecy
A cipher whose ciphertext reveals no information about the plaintext.
Exclusive-or (XOR)
A bit operation that yields 1 when its inputs differ and 0 otherwise.
One-time pad
XORing the message with a random, never-reused key of the same length.
Computational security
Security that holds because breaking the cipher is infeasible, not impossible.
Bounded adversary
An attacker limited by time, computing power, money, and available ciphertext.
Computational indistinguishability
A feasible adversary cannot tell which of two chosen messages a ciphertext encrypts.
Ciphertext-only attack
An attack using intercepted ciphertext alone.
Known-plaintext attack
An attack using some plaintext together with its ciphertext.
Chosen-plaintext attack
An attack in which the adversary gets chosen messages encrypted.
Chosen-ciphertext attack
An attack in which the adversary gets chosen ciphertexts decrypted.
Confusion
Making the relationship between key and ciphertext too complex to express.
Diffusion
Spreading the influence of each plaintext bit across many ciphertext bits.
S-box
A small nonlinear lookup table that provides confusion.
Avalanche effect
A one-bit input change altering about half the output bits.
Round
One application of a cipher’s repeated sequence of operations.

Randomness

True random number
A value produced by an unpredictable physical process.
Pseudorandom number generator (PRNG)
A deterministic algorithm that expands a seed into a long random-looking sequence.
Seed
The short secret value from which a pseudorandom generator starts.
Entropy source
A physical process whose measurements supply unpredictable bits.
Cryptographically secure pseudorandom number generator (CSPRNG)
A generator whose output cannot be predicted or distinguished from true randomness.
Entropy pool
An operating system’s collection of unpredictable events used to seed its generator.

Block Ciphers

Block cipher
A cipher that encrypts fixed-size blocks of bits under a key.
State
The array of bytes a block cipher transforms during encryption.
Key schedule
The procedure that expands a key into separate round keys.
Round key
The key material mixed into the state during one round.
Substitution-permutation network (SPN)
A block cipher structure alternating S-boxes, permutations, and key addition.
Feistel network
A block cipher structure that never needs to invert its round function.
Data Encryption Standard (DES)
The 1977 Feistel cipher with a 56-bit key, now broken by brute force.
Triple DES (3DES)
DES applied three times to extend its key length.
Meet-in-the-middle attack
Attacking double encryption from both ends to avoid searching both keys.
Birthday bound
The number of samples, about the square root of the possible values, after which repeats are likely.
Advanced Encryption Standard (AES)
The 2001 standard block cipher, with a 128-bit block and 128- to 256-bit keys.
Rijndael
The cipher family from which AES was standardized.
AES-NI
Processor instructions that compute AES rounds in hardware.

Modes of Operation

Mode of operation
The method for applying a block cipher to messages longer than one block.
Electronic codebook (ECB)
A mode that encrypts each block independently, exposing repeated blocks.
Cipher block chaining (CBC)
A mode that XORs each plaintext block with the previous ciphertext block.
Padding oracle
An attack that decrypts ciphertext using a server’s reports of valid or invalid padding.
Initialization vector (IV)
A random, non-secret block that starts CBC encryption of a message.
Counter (CTR) mode
A mode that encrypts counter values to produce a keystream.
Malleable
A property of ciphertext that lets an attacker make predictable changes to the plaintext.
Nonce
A number used once per message with a given key.
Galois/Counter mode (GCM)
Counter mode with an authentication tag added.
Authenticated encryption with associated data (AEAD)
Encryption that also produces a tag for detecting tampering.
Authentication tag
A short value that lets a receiver detect a modified ciphertext.
Associated data
Header information that an AEAD mode authenticates but does not encrypt.

Stream Ciphers

Keystream generator
A function that produces a keystream from a key and a nonce.
RC4
The biased stream cipher of the early Internet, now prohibited in TLS.
ChaCha20
The modern stream cipher built from additions, rotations, and XORs.
Poly1305
The authenticator paired with ChaCha20 in ChaCha20-Poly1305.

Cryptanalysis

Differential cryptanalysis
Tracing how plaintext differences propagate into ciphertext differences.
Linear cryptanalysis
Exploiting XOR relations among plaintext, ciphertext, and key bits that hold with bias.
Side-channel attack
Recovering secrets from an implementation’s timing, power, emissions, or faults.
Cache-timing attack
A side-channel attack that infers secrets from memory access patterns.
Power analysis
A side-channel attack that infers secrets from a device’s power consumption.
Fault injection
Inducing computation errors to reveal secrets from the faulty output.
Constant-time code
Code whose timing and memory accesses do not depend on secrets.
Masking
Randomizing intermediate values so that measurements do not correlate with secrets.
Bits of security
The exponent n when the best attack costs about 2^n operations.
Grover’s algorithm
A quantum search that halves the effective length of a symmetric key.