cryptopals

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 81ead5fb0d544b153aee2eca46d08603132db97e
parent bb32ac7587c90cd99c68e33a9c202768bee443da
Author: mpizzzle <michael.770211@gmail.com>
Date:   Sat,  7 Oct 2017 12:09:11 +0100

set 1 challenge 5 complete

Diffstat:
Aset1/repeating_key_xor.py | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/set1/repeating_key_xor.py b/set1/repeating_key_xor.py @@ -0,0 +1,10 @@ +import sys + +def encrypt(key, msg): + return ''.join([chr(ord(key[i % len(key)]) ^ ord(char)) for i, char in enumerate(msg)]) + +plaintext = "Burning 'em, if you ain't quick and nimble" +plaintext2 = "I go crazy when I hear a cymbal" +key = "ICE" + +print encrypt(key, plaintext + "\n" + plaintext2).encode("hex")+ \ No newline at end of file