In Cryptography, a block cipher is a keyed permutation from N-bit blocks to N-bit blocks.
Modes of operation
A block cipher is a simple primitive that takes a key, and can encrypt and decrypt fixed-size blocks of data. This means you need to use a block cipher in a way that makes it suitable to encrypt different sizes of data.
Electronic Code Book (ECB)
Electronic Code Book (ECB) mode is the block cipher in its raw form.
- Use the key with the block cipher to get your N-bit to N-bit permutation.
- Go over the plaintext in blocks, encrypt each block using the raw block cipher.
- There is no IV. With the same key, the same N-bit block always encrypts to the same ciphertext.
Counter mode (CTR)
- Instead of putting the plaintext through the block cipher, counter mode instead encrypts an incrementing counter to generate a keystream.
- The plaintext is then XOR’ed with the keystream.