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

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.txtSolution

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site