Question: PYTHON PYTHON You are hired to crack a password with the following intelligence gathering information: The password is 6 characters long. The person typing the
PYTHON PYTHON You are hired to crack a password with the following intelligence gathering information: The password is 6 characters long. The person typing the password follows touch-typing techniques. The first character is an upper-case letter typed with the left hand. The second character is a lower-case letter typed with the right hand. The third character is a digit. The fourth character is a lower-case letters typed with the left hand. The fifth character is a symbol from the number row in the keyboard The last character is a lower-case letter typed with the right hand. Intelligence was also able to recover the Hash of the password (SHA256). The hash is the following: ' 4886ad594177de63fe41fd947ef3f06fb52dcca8b0b7c8ff1759f5dfbe1c2142' Your program will generate all possible strings that meet the information gathered by Intelligence above. For each such string, it will calculate its SHA256 hash, and compare it against the hash recovered above. If the hashes are the same, then the program should print the generated string and terminate the program (a sys.exit() should do). If your program generates all possible strings following the intelligence gathered above and cannot find a match, the program should say so. In order to compute the hash of a string, add to your program the following import-clause and function. import hashlib def get_hash(string): m = hashlib.sha256() m.update(str.encode(string)) return m.hexdigest() To use this function, pass a string as an argument, and the function will returns the corresponding SHA256 hash as a string. Below is just an example call to this function, in the shell, to obtain the hash of the string "applesauce": >>> get_hash("applesauce") '6384e40c6c803bddae9d9348f39747a503cfe2edcc2eb1cbdfd87e065cfb5bfc'
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
