import itertools import string import hashlib def brute_force_crack(hash_to_crack, max_length): chars = string.ascii_lowercase + string.digits for length in range(1, max_length + 1): for guess in itertools.product(chars, repeat=length): guess = ''.join(guess) if hashlib.md5(guess.encode()).hexdigest() == hash_to_crack: return guess return None hash_to_crack = 'd0763edaa9d9bd2a9516280e9044d885' # 1234 max_length = 4 result = brute_force_crack(hash_to_crack, max_length) print(f'Found word: {result}')