Speed and Cipher Choice
Outcome: you know what your machine can do — measured, not guessed — and why the default cipher is almost always the right answer. Every number in this chapter came from the lab's own processor; transcript t07.
The two costs, kept separate
LUKS makes you pay in two different currencies, and confusing them causes most bad tuning:
- Unlock time — the one-off cost of deriving a key from your passphrase, paid once per open. Deliberately expensive (chapter 2): about two seconds, by design.
- Throughput — the ongoing cost of encrypting every byte as it moves. Paid forever, per byte, by the CPU. This is the one people fear, and the measurement below is the fear's antidote.
The benchmark
cryptsetup carries its own measuring stick, testing the kernel's ciphers in memory, no disk involved:
cryptsetup benchmark
The lab's machine — an AMD EPYC
server processor with AES hardware
acceleration (the aes flag in
/proc/cpuinfo, transcript t00) —
reported, for the rows that matter:
# Algorithm | Key | Encryption | Decryption
aes-xts 256b 1462.9 MiB/s 1323.7 MiB/s
aes-xts 512b 1222.9 MiB/s 1438.9 MiB/s
aes-cbc 256b 215.9 MiB/s 739.8 MiB/s
PBKDF2-sha256 2514570 iterations per second (256-bit key)
argon2id 9 iterations in 2000 ms at ~117 MB, 4 threads
Read it slowly:
- AES-XTS runs at over 1.2 GB per second in both directions. That is faster than nearly any single disk can move data — a SATA SSD tops out near 0.5 GB/s, a good NVMe drive rivals it — which means on hardware like this the cipher is not the bottleneck. Your disk is.
- The 512-bit XTS key is not slower in any way that matters. LUKS2's default (two 256-bit AES keys, used as a pair by XTS) costs the same as the 256-bit row within the noise of a shared machine. There is no performance excuse for shrinking it.
- CBC's one-way weakness is on display — encryption at 216 MB/s against decryption at 740. CBC encrypts blocks in a chain, which cannot be parallelised; XTS was designed for disk sectors precisely to avoid that. Nobody should choose CBC for a new disk, and the default doesn't.
- Serpent and Twofish report N/A on the lab machine: the sandbox kernel does not offer them. On a normal desktop kernel they benchmark honestly, and honestly slower than AES with hardware help. They exist for people whose threat model distrusts AES itself — a legitimate position, priced in throughput.
- The PBKDF rows are the unlock wall, priced. Two and a half million PBKDF2-sha256 iterations a second sounds fast until you recall the LUKS1 slot demanded 2.5 million per guess; Argon2id makes the same point in memory: nine tries in two seconds, each holding ~117 MB. That is what "expensive to guess" costs in numbers (chapter 6's passphrase advice is the other half).
AES-NI: the flag that decides
Everything above leans on four letters: AES-NI, the instruction set extension (Intel's name; AMD has the same instructions) that does AES in silicon. Check yours:
grep -o aes /proc/cpuinfo | head -1
If it answers, throughput is a non-issue on any machine built in the last decade and a half. If it does not — a small ARM board without crypto extensions, a very old netbook — the same benchmark tells you your real number before you commit a disk to it, and a cipher like XTS still usually beats the SD card or spinning rust beneath it. Run the benchmark before the format, on the machine that will carry the disk; numbers from a different processor are trivia.
Choosing, which is to say: not choosing
luksFormat defaults — aes-xts-plain64,
512-bit key, Argon2id, 4 KB sectors —
are the current consensus of people
who measure these things, and this
lab's measurements found nothing to
argue with. The honest exceptions:
- Sector size is a property of the disk, not a taste: 4 KB for modern drives (the format detects it), and the converted LUKS1 vault of chapter 12 kept its 512-byte sectors because its payload was laid out for them.
- Unlock time can be shortened
(
--iter-time) for a vault you open constantly on a slow machine — knowing that you are spending guessing-resistance to buy it. - Everything else — exotic ciphers, shrunken keys, disabled Argon2 memory — trades a measured good for an imagined one. The default is the recommendation; this chapter exists so you can say why.