#!/usr/bin/env python

import hashlib
import pyfiglet

print(pyfiglet.figlet_format("md5 cracker"))

wordlist_location = str(input("Wordlist file location: "))
hash_input = str(input("Enter hash to be cracked: "))

with open(wordlist_location, 'rb') as _f:
    for line in _f.readlines():
        line = line.strip()
        hash_ob = hashlib.sha256(line)
        #hash_ob = hashlib.md5(line)
        hashed_pass = hash_ob.hexdigest()
        print(line)
        if hashed_pass == hash_input:
            print("Password found: " + line.decode())
            exit(0)
