Skip to content

Instantly share code, notes, and snippets.

@hernamesbarbara
Last active August 29, 2015 14:22
Show Gist options
  • Save hernamesbarbara/5fd564e2af7ae0180efc to your computer and use it in GitHub Desktop.
Save hernamesbarbara/5fd564e2af7ae0180efc to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""atbash.py
"""
from string import letters
def atbash(txt):
sub_table = zip(letters[:26], "".join(reversed(letters[:26])))
sub_table += zip(letters[26:], "".join(reversed(letters[26:])))
sub_table = dict(sub_table)
s = ""
for char in txt:
if char in letters:
s += sub_table[char]
else:
s += char
return s
print atbash('[email protected]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment