AES & Block Cipher Modes Activity
In order to understand cryptography it it important to understand some basic crypto terms:
Confusion:Â Each binary bit of the ciphertext should depend on several parts of the key, obscuring connections between the two. A substitution algorithm is usually used to achieve confusion. An example of this is the caesar cipher.
Diffusion:Â If we change a character of the plaintext then several characters of the ciphertext should change and vice versa. Achieved through a transposition algorithm.
Avalanche Effect:Â The desirable property of cryptographic algorithms (typically block ciphers and cryptographic hash functions) wherein if an input is changed slightly (eg a single bit) the output is changed significantly (eg half the bits).
SP Boxes: An S-box (substitution box) is used to create confusion and obscures the relationship between the key and the ciphertext. A P-box (permutation box) is a method of bit-shuffling used to permute or transpose bits across S-boxes inputs, retaining diffusion while transposing. Together these satisfy Claude Shannon’s confusion and diffusion properties.
Fiestal Networks:Â A symmetric structure used in the construction of block ciphers. Has the advantage that encryption and decryption options are very similar so the code or circuitry required for implementation is nearly halved.Â
Block Ciphers:Â A deterministic algorithm operating on fixed-length groups of bits, called a block, with an unvarying transformation that is specified by a symmetric key.Â
Stream Ciphers:Â A symmetric key cipher where plaintext digits are combined with a pseudorandom cipher digit stream (keystream). In a stream cipher, each plaintext digit is encrypted one at a time with the corresponding digit of the keystream.Â
Both DES and AES are forms of block ciphers, which encrypt a fixed amount at a time. Cipher modes include:
ECB - Electronic Code Book
Encode each fixed block separately. Disadvantage is that every input will produce the same output, making analysis trivial.
CBC - Cipher Block Chaining
Past block is incorporated into the current block. Since first block doesn’t have a past block it uses an initialisation vector (IV); a random value. Prevents problems occurring from ECB but makes encryption very slow as no longer parallelizable - need to wait for previous block before starting on next.
Turns the AES block cipher into pseudo-stream cipher.  Instead of encrypting the plain text, CTR mode encrypts a random NONCE and counter value, which is increased with every block. Because of the diffusion and confusion properties of AES a small change results in a large change. This long string of pseudorandom bits is treated like a stream cipher - the actual plaintext is XORed with the output of the encryption of the NONCE and counter, and the real cipher is the result of the XOR operation. The result is a cipher mode that doesn't suffer from the problems of ECB, but is also parallelisable in the encryption and decryption stages.Â
Methods of solving each puzzle:
The output was the same from the same word (once the block size - 16 characters - has been reached)
The output length was determined by input length
Wasn’t ECB and the output was always the length of a block size