Definition
Electronic Codebook Mode
Electronic Codebook mode is a mode of operation for a block cipher in which each plaintext block is encrypted independently under the same key.
For plaintext blocks , the ciphertext blocks are:
Mechanism
ECB applies the block cipher separately to each block. There is no chaining between blocks and no additional integrity check.

This has several consequences:
- Equal plaintext blocks produce equal ciphertext blocks
- Ciphertext blocks can be copied, removed, or rearranged without affecting the decryption of other blocks
- A bit flip in a ciphertext block produces random errors exclusively in the corresponding plaintext block
Repeated plaintext blocks
If , then
So repeated structure in the plaintext remains visible in the ciphertext at the block level.
Avoidance
When to avoid ECB
ECB should be avoided, unless the message to be encrypted is not larger than a single block.
Block splicing
Because each block is independent, an attacker can often build a new valid ciphertext by reusing blocks from other valid ciphertexts.
This does not reveal the key, but it may still let the attacker create a ciphertext whose decrypted fields have a different meaning.
Badge forgery by block reuse
Suppose a badge plaintext is divided into four blocks:
where stores the user role.
If the attacker chooses the input so that decrypts to
curator, then the ciphertextdecrypts to a badge whose role block is
curator.
Limitation
ECB provides neither semantic security for structured multi-block data nor integrity protection. For this reason, it is usually unsuitable for records, tokens, or other structured messages.