-
-
Save stevekrenzel/ccda26ce1df4e72c1d53 to your computer and use it in GitHub Desktop.
ROT-13
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
>>> from string import ascii_lowercase, ascii_uppercase, maketrans, translate | |
>>> target = ascii_lowercase[13:] + ascii_lowercase[:13] + ascii_uppercase[13:] + ascii_uppercase[:13] | |
>>> tr = maketrans(ascii_lowercase + ascii_uppercase, target) | |
>>> translate("This is a message", tr) | |
'Guvf vf n zrffntr' | |
>>> "This is a message.".encode('rot13') | |
'Guvf vf n zrffntr.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment