# Implementing AES-CBC (Matasano Crypto Challenge 10)

I am currently doing the Matasano Crypto Challenge to learn a bit about cryptography. In that specific challenge one had to implement AES in CBC mode. I did that and verified that encryption and decryption are working using these test vectors. I can't manage to decrypt the message given in the challenge though. I am not asking you to decrypt it, but when I thought about it a bit more I got a bit confused due to the used IV (which is 0x00 for each byte). Doesn't this IV have no effect at all since the decrypted message just get's XORed against the IV? Shouldn't decryption also be possible using simple AES-ECB?

EDIT: Sourcecode in Java: http://pastebin.com/cX8YZjD0

• IV equals to constant zero means that the IV has no impact only on the first block. but for all the others something changes, try to give a look to this picture (from here: di.ens.fr/~jean/latex_crypto). For the first block you xor it with zero, but for the second you xor it with $c_0$ ... – ddddavidee Dec 1 '15 at 12:51
• True, I forgot about that since I only dealt with 16 byte texts.. But the first 16 byte are encrypted just like with ECB, aren't they? Does this also mean something is wrong when my algorithm produces random gibberish in the first 16 bytes? – Joba Dec 1 '15 at 13:06
• You might have the wrong key. Or maybe the first 16 bytes of plaintext are gibberish. With an all 0 IV and 16 byte plaintext, yes, it is equivalent to ECB. – mikeazo Dec 1 '15 at 13:38
• @Joba, sorry, I did not check the plaintext length, so my comment was more general. – ddddavidee Dec 1 '15 at 13:43