Skip to content

Commit 795d8ea

Browse files
authored
Merge pull request #110 from jatinluthra14/repkey_xor
Implement Repeating Key Xor
2 parents 86f3a3c + 56ff364 commit 795d8ea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Cryptography/Repeating_key_xor.py

+7
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)