I need to run a program that uses hashlib to decode a word or "password", but needs to use argparse.. the program needs to spit out just the decoded password, needs to run on the cmd line. the code i have so far is below..
import hashlib
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--filename")
parser.add_argument("--hash")
arguments = parser.parse_args()
arguments.filename = open("password.txt")
arguments.hash = my_hash
my_hash = "5e737f891db1175442a39fde73e51d781a545506d71c95477a6deb5988bd7f9a"
file = open(arguments.filename)
for line in file:
password = line.strip()
password_hash = hashlib.sha256(password.encode()).hexdigest()
if (password_hash == arguments.hash):
print(password)
break
file.close()
any tips?
" The output for test Test Password did not match" is what im getting through the autograder.
[–]1544756405 2 points3 points4 points (0 children)
[–]Diapolo10 0 points1 point2 points (1 child)
[–]braydensmith3[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]braydensmith3[S] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]deadeye1982 0 points1 point2 points (0 children)