Python Prompt a user to enter a password Encrypt the passwor
Python
Prompt a user to enter a password. Encrypt the password the user enters using the SHA-512 algorithm and write it into an empty file passwords.txt
Solution
import hashlib
myfile = open(\"input.txt\",\"w\")
password = raw_input(\"Enter password \")
hash_object = hashlib.sha512(password)
hex_dig = hash_object.hexdigest()
myfile.write(str(hex_dig))
myfile.close()
