initialization vector message/password GO_NAVY_2018^mid TheRainInSpainFallsMainlyOnThePlain | \______________/\______________/\_/ | block 0 block 1 block 2 | | | | | | | | | .----msg-------. | | `-------------------iv|shift+vigenere| | | | of block 0 | | | `--------------' | | | | | .----------' | | | .--------------' | TgrTfU<O;oaNSQy. | | | .----msg-------. | `--iv|shift+vigenere| | | of block 1 | | `--------------' | | | .----------' | | .------------------------' biq>n8JC-J8[;A0+ | | .----msg------- `--iv|shift+vigenere| | of block 2 | `--------------' | | V v-K2JJX?B@,MIJ0b hash
vaultEC2 | ~/$ java Vault vaultEC2 username: flipper password: ThisIsExactly_16 Access granted! $ quit |
~/$ java Vault vaultEC2 username: flipper password: ThisIsExactly_16_plus_some Access denied! |
user flipper shift+vigenere 4rgZDs.8u1bjr5A/ user shamu shift+vigenere K>0F_<6vvHfYP:c^ |
||
~/$ java Vault vaultEC2 username: shamu password: ThisIsExactly_16 Access denied! |
~/$ java Vault vaultEC2 username: shamu password: ThisIsExactly_16_plus_some Access granted! $ quit |
message/password = i_stay_out_too_late/got_nothing_in_my_brain/thats_what_people_say_mmm-mmm \______________/\______________/\______________/\______________/\_______/ block 0 block 1 block 2 block 3 block 4 block 0: iv = GO_NAVY_2018^mid msg-block = i_stay_out_too_l output = pOoM*KD<8R4zgntE block 1: iv = pOoM*KD<8R4zgntE msg-block = ate/got_nothing_ output = O\n\ek;^Lz.`Sg-. block 2: iv = O\n\ek;^Lz.`Sg-. msg-block = in_my_brain/that output = N@w\@y/y-;XfaB39 block 3: iv = N@w\@y/y-;XfaB39 msg-block = s_what_people_sa output = S*1qUS;Zl<3<aGg[ block 4: iv = S*1qUS;Zl<3<aGg[ msg-block = y_mmm-mmm output = 3BA7]rwjY\*8?cdZ hash = 3BA7]rwjY\*8?cdZ
One weakness of full shift+ hashing as we've presented it, is that it is vulnerable to an "extension attack". The idea is this: suppose Alice has a message M for which she computes hash H. She keeps message M secret, and sends H to Bob. Suppose an attacker, Eve, intercepts H. If the length of M is a multiple of 16, Eve can use H as the iv in computing the hash of some message E, and she will have computed the correct hash for ME, i.e. message M concatenated with message E, even though she doesn't know the message M. In many contexts, this weakness is not important, but in some contexts it is. So it would be preferable to have a hash algorithm without it.
I invite you to think about how you might modify full shift+ hashing (assuming the vigenere cipher) to repair this vulnerability.