What is the cryptanalytic difference between encrypting a PIN block with a fixed key versus a random key encrypted under a master key?
A fixed key lets the attacker narrow down candidates quickly through "contour" — the key produces consistent patterns across multiple test encryptions. A random key per transaction has no contour, making exhaustive search much harder.
Method 1: Fixed encryption key
- The same key encrypts every PIN block
- Cryptanalytic advantage: With a known-plaintext exhaustive key search, testing just 4–10 ciphertexts (PINs 0000–9999) produces a clear "contour" — after about 1.1 complete searches, the fixed key is found
- Once found, all future PINs are compromised
Method 2: Random key + master key
- A fresh random session key encrypts each PIN block
- The random key itself is encrypted under a fixed master key and sent alongside
- Cryptanalytic disadvantage for attacker: The random key has no "contour" — brute-forcing it looks like random noise, and you cannot distinguish the correct key from wrong ones as easily
- Each transaction uses a different key, so breaking one doesn't help with others
The "contour" concept: When you brute-force a fixed key, the correct key will consistently decrypt test data to valid-looking results. A random key used only once doesn't give the attacker enough data to build that pattern.
Tip: This is analogous to the difference between a reused vs. single-use password — reuse creates a pattern attackers can exploit.