Skip to content

Instantly share code, notes, and snippets.

@s3thi
Created December 8, 2011 10:30
Show Gist options
  • Save s3thi/1446664 to your computer and use it in GitHub Desktop.
Save s3thi/1446664 to your computer and use it in GitHub Desktop.
Caesar Cipher #2
import string
from collections import deque
alphabet = string.ascii_lowercase
alphabet_deque = deque(alphabet)
alphabet_deque.rotate(-2)
rotated_alphabet = ''.join(alphabet_deque)
tbl = string.maketrans(alphabet, rotated_alphabet)
msg = 'a quick brown fox jumped over the lazy dog'
encoded_msg = string.translate(msg, tbl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment