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()

PythonPrompt a user to enter a password. Encrypt the password the .pdf

  • 1.
    Python Prompt a userto 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()