AES-CTR
Counter mode: turns AES into a fast, parallel stream cipher
Overview
CTR (Counter) mode turns a block cipher into a stream cipher by encrypting successive counter values and XORing the result with the plaintext. It is defined in NIST SP 800-38A and is the encryption half of AES-GCM.
A counter block is formed from a nonce and a block counter. Each counter value is encrypted with AES to produce 16 bytes of keystream, which are XORed with the plaintext. Because each block depends only on its counter, encryption and decryption are fully parallel, allow random access, and require no padding. Decryption uses AES encryption, not decryption.
NextSSL includes AES-128-CTR, AES-192-CTR and AES-256-CTR. CTR is the most efficient confidentiality-only mode on modern hardware, since the AES calls for all blocks can be pipelined, and it is the basis of GCM, CCM, GCM-SIV and many random-bit generators. The counter block layout, such as a 96-bit nonce and 32-bit counter, must be fixed by the protocol.
History
1979–2001Counter mode proposed by Whitfield Diffie and Martin Hellman
Standardised for AES in NIST SP 800-38A
Security notes
CTR is secure only if no counter block is ever reused under a key; reuse reveals the XOR of two plaintexts. It provides no integrity: flipping a ciphertext bit flips the same plaintext bit. Pair it with a MAC or use AES-GCM.
Typical uses
Variants in NextSSL
3| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| AES-128-CTR aes-128-ctr |
standard FIPS | key 16 · nonce 16 | NIST SP 800-38A | safe |
| AES-192-CTR aes-192-ctr |
standard FIPS | key 24 · nonce 16 | NIST SP 800-38A | safe |
| AES-256-CTR aes-256-ctr |
standard FIPS | key 32 · nonce 16 | NIST SP 800-38A | safe |
Frequently asked questions
Which AES-CTR variants does NextSSL include?
NextSSL registers 3 AES-CTR variants: aes-128-ctr, aes-192-ctr, aes-256-ctr.
Families with similar names
Other stream ciphers
All 37Related
Counter-mode AES with a GHASH polynomial MAC; the default AEAD of TLS and IPsec
ChaCha20-Poly1305ARX stream cipher with a one-time Poly1305 MAC; fast and constant-time in software
AESThe Advanced Encryption Standard: the world's default 128-bit block cipher
AES-OFBOutput Feedback mode: a synchronous stream cipher from repeatedly encrypting the IV
ChaChaBernstein's ARX stream cipher; ChaCha20 secures much of today's TLS, SSH and VPN traffic