Last active
March 25, 2025 10:30
-
-
Save ay0ks/d0bfc2fe23b7fd473faca14398c7e96e to your computer and use it in GitHub Desktop.
PoC One-Time Pad encryption in Python
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
otp = lambda *args: [a ^ b for a, b in zip(*args)] |
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
data = b"Hello World!" | |
# One-Time Pad encryption usually requires the encryption key to be at least the same length as | |
# the input data, or longer. | |
key = __import__("os").urandom(len(data)) | |
print(otp(data, key)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment