Last active
April 2, 2018 07:09
-
-
Save yarjor/d486371b0561a5aae9368641a0d7cf7c to your computer and use it in GitHub Desktop.
[XOR Strings] #crypto #xor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def repeating_key_xor(st,key): | |
| return xor_strings(st, itertools.cycle(key)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def xor_strings(a, b): | |
| return ''.join([chr(ord(i) ^ ord(j)) for i, j in zip(a, b)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment