Question: Problem 3 The variables hash 4 and hash 5 contain two mystery hashes. I'll give you a hint: they are constructed by taking a word

Problem 3
The variables hash4 and hash5 contain two mystery hashes. I'll give you a hint: they are constructed by taking a word from the rockyou list and appending a single digit. For example, morgan3 or shadow7. This is a common thing people to do choose "good" passwords. But they are easy to crack because it's such a predictable pattern.
Write a function to solve this problem for you. Paste your solutions into the word4 and word5 variables, respectively. You can name the function whatever you want; the function itself won't be checked.
hash4='610c23407eb63d963c73cdda8703b506'
hash5='82f1742b8fef8c2379698be495c29c3d'
# You may need this to help solve the problem
digits =[b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9']
def crack_hash_with_digit_suffix(target_hash):
digits =[b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9']
for word in crack_hash_with_digit_suffix:
for digit in digits:
plaintext = word.encode()+ digit
hashed = md5(plaintext).hexdigest()
if hashed == target_hash:
return plaintext
return None
# Paste your solution here
word4= crack_hash_with_digit_suffix(hash4)
word5= crack_hash_with_digit_suffix(hash5)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
1 # Paste your solution here
---->2 word4= crack_hash_with_digit_suffix(hash4)
3 word5= crack_hash_with_digit_suffix(hash5)
in crack_hash_with_digit_suffix(target_hash)
4 def crack_hash_with_digit_suffix(target_hash):
5 digits =[b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9']
---->6 for word in crack_hash_with_digit_suffix:
7 for digit in digits:
8 plaintext = word.encode()+ digit
TypeError: 'function' object is not iterable
# Run this cell to check your answers
from functools import reduce
import operator
assert reduce(operator.mul, word4)%0xffffe ==779296
assert reduce(operator.mul, word5)%0xffffe ==974694
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
in
2 from functools import reduce
3 import operator
---->4 assert reduce(operator.mul, word4)%0xffffe ==779296
5 assert reduce(operator.mul, word5)%0xffffe ==974694
NameError: name 'word4' is not defined

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!