def test_the_attack(): messages = ( b'Attack at dawn', b'0123456789abcdef0123456789abcdef462f0aec8f910e6b5daf6c47947de80c954a8b97fa9e58780f8298c6d06c05de0ab8b4d1a0bc03cf7c8ba306360a4f13725bc1e1021f34885a4c5349155c6ab91c9a22110d07dbc3f150672aeeb09b95baa2f7ea8b9b04644313c7787891f5884b4366499578d84631e0a488c63d7198bde5d0f8737ce6d6964da64bc674eadf9056091bbe674d781fe835384b296622643a7bd79c6d1c7f06185a26d5c81b25873d88850b6f79ff6865dfbc5c9a0e8ec000bf26daf8fe54a801fc11e0e68fed700c7bfef81206d028dfbef3d0311cb1' ) for msg in messages: print('Testing:', msg, 'OF LENGTH', len(msg)) cracked_ct = attack(encrypt(msg)) assert (cracked_ct == msg)
def test_the_attack(): messages = (b'Attack at dawn', b'', b'Giovanni', b"In symmetric cryptography, the padding oracle attack can be applied to the CBC mode of operation," + b"where the \"oracle\" (usually a server) leaks data about whether the padding of an encrypted " + b"message is correct or not. Such data can allow attackers to decrypt (and sometimes encrypt) " + b"messages through the oracle using the oracle's key, without knowing the encryption key") for msg in messages: print('Testing:', msg) cracked_ct = attack(encrypt(msg)) assert cracked_ct == msg
def test_attack(): message = "Sloths are incredibly awesome" output = attack(encrypt(message)) print(output)