Skip to content

Instantly share code, notes, and snippets.

@austinogilvie
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save austinogilvie/5fd564e2af7ae0180efc to your computer and use it in GitHub Desktop.

Select an option

Save austinogilvie/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('zfhgrmltroerv@tnzro.xln')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment