[Tutor] Clunky Password maker

Wolf Halton wolf.halton at gmail.com
Thu May 26 23:45:57 CEST 2011


I have a 0.2 version

[code]
def new_pass(p):
    valchars = string.ascii_letters + string.digits + string.punctuation

    series = list(valchars)
    pp = int(raw_input("Enter the length you want your password to be:[%i] "
% (p)) or p)
          # length of password chosen or default length

    rr = random.sample(series, pp)

    print "\nYour New Password is: \n"
    print "".join(rr), "\n"
[/code]

Now I am looking at how to make it have an admin function to set the valid
characters, and have a way to output the password into main()

The modules for finding the hashes produce many unreadable characters:
[code]
def md_five():
    print "Enter a password and find the MD5 hash"
    passwd = raw_input("Enter your password for testing: ")
    m = hashlib.md5()
    m.update(passwd)
    print "\nThe password", passwd, " is ", m.digest(), "\nand that hash in
hex is | ", m.hexdigest()
    print ""
[/code]
[output]
Enter 1 to run a MD5    hash on your password
Enter 2 to run a SHA1   hash on your password
Enter 3 to run a SHA224 hash on your password
Enter 9 to get a new randomy password
Enter 10 to run away...  he he he

Enter your choice here> 1
Enter a password and find the MD5 hash
Enter your password for testing: bad_password

The password bad_password  is  "vMᆬU< ̀ÌWンᄉᄑ"W
and that hash in hex is |  22764da5553c20cc80cc579db5bd2257
[/output]


-- 
This Apt Has Super Cow Powers - http://sourcefreedom.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110526/7fdf4e16/attachment.html>


More information about the Tutor mailing list