A mode of operation encrypts a message of several blocks with a block cipher. ECB mode encrypts each block alone: . CBC mode chains them: , starting from , an initialisation vector (IV) that must be unpredictable and is sent with the ciphertext; decryption computes . Padding extends the message to a whole number of blocks; PKCS#7 padding adds bytes of value , , and is checked and removed after decryption. CTR mode turns the block cipher into a stream cipher: , with a counter block that must never repeat under one key. A padding oracle is any way for an attacker to learn whether the padding of a ciphertext of its choice was valid.
figures/ecb.dat, encrypted with AES-128. In ECB each run of 16 equal pixels becomes the same 16 bytes, and the shapes stay visible; in CBC the ciphertext looks random.