IT lexicon › Security › CTR

CTR

Security På svenska → Updated: 2026-08-03

Turns a block cipher into a stream cipher by encrypting a counter instead of the message.

Counter mode encrypts a sequence of counter values and XORs the result with the plaintext. The cipher is therefore never applied to user data at all — it only produces a keystream. The advantages are substantial: no padding is needed, both encryption and decryption parallelise, and you can jump straight to block one thousand without computing the ones before it.

The danger is easy to state and easy to walk into: reuse the same counter value under the same key and the same keystream is produced twice, so XORing the two ciphertexts reveals the XOR of the plaintexts. It is the same failure as reusing a one-time pad. CTR forms the basis of GCM, which adds authentication on top.

← Back to the lexicon