Created
September 24, 2022 13:08
-
-
Save strboul/685d484e310d0723757f05327246ff70 to your computer and use it in GitHub Desktop.
This file contains 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
import string | |
import random | |
message = "hello world from python" | |
# secret = ''.join(random.choices(string.ascii_uppercase + string.digits, k=100)) | |
secret = 'bob' | |
encrypted = ''.join([chr(ord(a) ^ ord(b)) for a, b in zip(message, secret)]) | |
decrypted = ''.join([chr(ord(a) ^ ord(b)) for a, b in zip(encrypted, secret)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment