Is there a less clunky way to do this?
[code]
def new_pass():
    series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-',
'=', \
              '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_',
'+', \
              'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
'\\', \
              'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
'|', \
              'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', "'", \
              'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', \
              'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', \
              'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?']
    passwd = []
    p = input("Enter the length you want your password to be: ")
              # length of password
    for i in range(p):
        r = random.randint(0, 94)
        passwd.append(series[r]) # Append a random char from series[] to
passwd
    #print passwd
    #print passwd[0], passwd[1], passwd[2], passwd[3]
    print ""
    print "".join(map(str, passwd)), " is your new password. \n"
[/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> 9
Enter the length you want your password to be: 4

!bnR  is your new password.
>>>
[/output]

-- 
This Apt Has Super Cow Powers - http://sourcefreedom.com

Attachment: hashy.py
Description: Binary data

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to