Created
February 8, 2011 17:17
-
-
Save ckunte/816786 to your computer and use it in GitHub Desktop.
Make your own cipher and use it to generate your custom password.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 "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.)" | |
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