Reputation: 81
Trying to create a script that simply accepts a list of passwords, then prints them back out in plain text, and hashed with md5. The problem is I am trying to use two functions and cannot get them to work correctly. The passwordlist function should accept the passwordlist as an argument and then loop through each item in the list and print the actual password, a comma, and then the md5 encrypted password. The makemd5 function is simply to create the hash.
import hashlib
passwordlist = ["password","123456","12345678","1234","qwerty","12345",
"baseball","football","letmein","monkey","abc123","mustang","michael"]
def makemd5(key_string):
new_key_string = key_string.encode('utf-8')
return (hashlib.md5 ( new_key_string ).hexdigest())
def createmd5list(passwordlist):
for key_string in passwordlist:
return (key_string, makemd5)
def main():
hashlist = createmd5list(passwordlist)
print(hashlist)
main ()
Upvotes: 0
Views: 126
Reputation: 81
import hashlib
passwordlist = ["password","123456","12345678","1234","qwerty","12345",
"baseball","football","letmein","monkey","abc123","mustang","michael"]
def makemd5(key_string):
new_key_string = key_string.encode('utf-8')
return (hashlib.md5 ( new_key_string ).hexdigest())
def createmd5list(passwordlist):
for passlist in passwordlist:
hashlist = makemd5(passlist)
print (passlist,",",hashlist)
def main():
passlist = createmd5list(passwordlist)
print(passlist)
main ()
Upvotes: 0