Created
July 21, 2015 21:14
-
-
Save packetchef/8c346fa2d85e34da15f6 to your computer and use it in GitHub Desktop.
Demonstrate rot13 encoding
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 | |
rot13 = string.maketrans( | |
"ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz", | |
"NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm" | |
) | |
encodedString = string.translate('Hypatia', rot13) | |
decodedString = string.translate(encodedString, rot13) | |
print('Encoded string is {string}'.format(string=encodedString)) | |
print('Decoded string is {string}'.format(string=decodedString)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment