Skip to content

Instantly share code, notes, and snippets.

@tom-wagner
Last active March 11, 2019 18:24
Show Gist options
  • Save tom-wagner/6484476c71a8a4122e21189a3aed1c18 to your computer and use it in GitHub Desktop.
Save tom-wagner/6484476c71a8a4122e21189a3aed1c18 to your computer and use it in GitHub Desktop.
sprintly11.py
import re
def rotate_if_letter(char):
if re.search('[a-zA-Z]', char):
return chr(ord(char) + 13) if re.search('[a-mA-M]', char) else chr(ord(char) - 13)
return char
def rot13(message):
return ''.join([rotate_if_letter(char) for char in message])
def simple_transposition(text):
return text[0::2] + text[1::2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment