liveBook · Manning

Counter mode encryption

As explained in Hacking Cryptography

Counter mode encrypts successive counter values with a block cipher to generate a keystream that is combined with plaintext.

Counter mode (CTR) turns a block cipher into a keystream generator: it encrypts successive counter values, then combines the resulting keystream with plaintext. section 5.3

This approach addresses the problem of encrypting multiple blocks without independently encrypting identical plaintext blocks, as ECB does. section 5.3

Figure 5.4 Stream ciphers generate a keystream, which is subsequently XORed to encrypt. Block ciphers directly output the ciphertext after encryption.
figure

Compare block-cipher output with the keystream-and-XOR structure that counter mode uses. section 5.3

How Hacking Cryptography covers it

How deep it goes
Defines keystream generation and plaintext combination, but does not provide implementation steps or attack analysis.
Examples
Uses a keystream-generation diagram to contrast stream-cipher processing with direct block-cipher ciphertext output.
What you can do after
Evaluate how block-cipher processing can emulate keystream-based encryption across multiple plaintext blocks.
How it connects
Connects block ciphers with stream ciphers, keystreams, XOR, plaintext, ciphertext, and ECB mode.

Also explained in

Compare how 2 books explain counter mode encryption →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Hacking Cryptography. The section links point to the parts of the book it draws on.