AES-ABC - 400pt
AES-ECB is bad, so I rolled my own cipher block chaining mechanism - Addition Block Chaining! You can find the source here: aes-abc.py. The AES-ABC flag is body.enc.ppm
You probably want to figure out what the flag looks like in ECB form...
The key to solve this challenge is to notice that the custom algorithm is applied over the AES-EBC encryption of the original image. The weakness of this algorithm is that it encrypts the byte strings in input only considering their value. This means that every byte string having value
<code>x</code><code> will be encrypted to </code><code>y = enc(x)</code>.\
In the case of an image, this can be particularly useful because it's pretty likely that the contours of the shapes in the encrypted result will still be clearly distinguishable.
Since the encoding is based on a cumulative sum, the decoding will have to use a cumulative subtraction.\
The first chunk of the encrypted data is left unchanged. This means that it is common for both the plain and the cipher data. Plus, every chunk is obtained by summing the others, therefore the last chunk contains the sum (even if mod UMAX) of all of the chunks of the plain image.\
To reverse this, we can simply update every element with the difference of itself and the element before it. It's important to remember that, since in the encryption algorithm all of the operations were mod UMAX, this will have to be replicated in the decryption procedure. The combination of the data outputted by this algorithm with the PPM header will generate an AES-EBC encryption of the flag, where said flag can be read.