Stream cipher family

AES-CTR

Counter mode: turns AES into a fast, parallel stream cipher

standard 3 variants NIST SP 800-38A

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–2001
  1. Counter mode proposed by Whitfield Diffie and Martin Hellman

  2. 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

Building AES-GCM and CCMRandom-access encryptionFast keystream generation and DRBGs

Variants in NextSSL

3
AlgorithmTierSizes (bytes)StandardsAPI
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.