Skip to content

Instantly share code, notes, and snippets.

@ckunte
Created February 8, 2011 17:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckunte/816786 to your computer and use it in GitHub Desktop.
Save ckunte/816786 to your computer and use it in GitHub Desktop.
Make your own cipher and use it to generate your custom password.
#!/usr/bin/env python
# encoding: utf-8
"""
Make your own cipher and use it to
generate your custom password.
1. Think of a phrase that you love.
2. Encode it with your custom cipher.
3. Use it as your password.
Should you decide to use your own cipher, then
think of a suitable set of characters to
substitute. The following is just an example.
"""
import string
"""
# Your custom cipher
`user` is standard character set.
`subs` is character substitution set for `user`.
"""
user = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkl\
mnopqrstuvwxyz"
# Start editing.
# Remember to use your own custom substitution below.
subs = "fghijvwxyzabcdekVWXYZAmnopqrstuBCDEKLMN\
OPQRSTUlFGHIJ"
# End of editing.
def main():
print
print "Remember to salt your familiar"
print "word/phrase. (Salting is introducing"
print "a combination of random special"
print "characters and numerals in your"
print "familiar phrase that you plan to"
print "encode.)"
print
usertxt = raw_input("Text to be encoded: ")
ciptrans = string.maketrans(user, subs)
p = usertxt.translate(ciptrans)
print "Plain text : ", usertxt
print "Ciphered text: ", p
pass
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment