We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 86f3a3c + 56ff364 commit 795d8eaCopy full SHA for 795d8ea
Cryptography/Repeating_key_xor.py
@@ -0,0 +1,7 @@
1
+import itertools
2
+def repkey_xor(b,key):
3
+ return b''.join([xor(chr(x).encode(),chr(y).encode()) for (x,y) in zip(b,itertools.cycle(key))])
4
+
5
+text = "Sir Issac Newton formulated the laws of motion and universal gravitation"
6
+key = "APPLE"
7
+print(repkey_xor(text,key))
0 commit comments