AES-256-CTR
Counter mode: turns AES into a fast, parallel stream cipher
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–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
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 32 | Secret key |
| nonce | 16 | Nonce / 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
nextssl_stream_apply("aes-256-ctr", NULL, key, nonce, data, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_streamcipher_in(reg::all(), Policy::Safe, "aes-256-ctr", &Params::new())?;
let ct = alg.apply_keystream(&key, &nonce, b"secret")?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Other AES-CTR variants
2Similar names
Looking for something else?More stream ciphers
All 37Frequently 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.
Related families
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