Plaintext blocks (front) Ciphertext blocks (back)
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Block Cipher Modes: ECB vs CBC

Cryptography basics usually stop at "encrypt the message," but a block cipher only ever encrypts one fixed-size block, and how those blocks are chained together — the mode of operation — matters as much as the cipher itself. This simulator arranges a grid of plaintext blocks in 3D and encrypts every block with the same toy keyed cipher under two real modes: Electronic Codebook (ECB), which encrypts each block independently, and Cipher Block Chaining (CBC), which XORs each block with the previous ciphertext block before encrypting. Switch between a flat background pattern and a "background + subject" layout to reproduce the classic ECB failure — identical plaintext blocks always produce identical ciphertext, so structure leaks straight through — while CBC's chaining scrambles the same data into something with no visible repetition, and live readouts count exactly how many ciphertext blocks collide under each mode.