Stream ciphers

AES-256-CTR

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

standard Safe API Specified in a FIPS standard

About AES-256-CTR

AES-256-CTR is one of 3 AES-CTR variants in the NextSSL registry, a stream cipher. It uses a 32-byte (256-bit) key and a 16-byte nonce. Its registry entry cites NIST SP 800-38A. It is also known as aes256-ctr. NextSSL lists it in the standard tier and exposes it through the safe API.

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

Sizes

FieldBytesMeaning
key32Secret key
nonce16Nonce / IV

Use it

from nextssl_demo import NextSSL

ns = NextSSL()              # safe API: safe and standard tiers
ct = ns.call("stream_apply", "aes-256-ctr", None, key, nonce, b"secret")[0]   # same call decrypts

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Other AES-CTR variants

2

Frequently asked questions

What is AES-256-CTR?

AES-256-CTR is a stream cipher in the AES-CTR family. 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 also known as aes256-ctr.

What are the AES-256-CTR sizes?

In NextSSL, AES-256-CTR uses: key 32 bytes, nonce 16 bytes.

Who designed AES-256-CTR and when?

AES-256-CTR belongs to the AES-CTR family, first published in 1979. Its origin: NIST SP 800-38A.

Which standards define AES-256-CTR?

AES-256-CTR is referenced by NIST SP 800-38A. It is specified in a FIPS standard.

Is AES-256-CTR safe to use?

AES-256-CTR is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.

What other AES-CTR variants are there?

NextSSL also registers aes-128-ctr, aes-192-ctr in the AES-CTR family.