Author: Admin 07/15/2026
Language:
Python
Tags: python hash md5 sha1 sha224 sha3_224 sha256 sha3_256 sha384 sha3_384 sha512 sha3_512
This is a python program I built to recover passwords from an old database/application for my work so they can be ported to a new application.
import hashlib
import tkinter as tk
from tkinter import filedialog
# HASH Check was built to compare plain text passwords with a HASH list.
# I built this to recover passwords from an old database/application for my work.
# Built by Brian Henry of Henrys-software.com
# Date: 12/15/2025 - Version: 1.0.0.21
# Color codes
RED = '\033[31m'
GREEN = '\033[32m'
RESET = '\033[0m' # Code to reset color/style
print(RED + "\nCompare a plain text password list with a HASHed password list." + RESET)
print(GREEN + "Supported HASH's: MD5, SHA1, SHA224, SHA3_224, SHA256, SHA3_256, SHA384, SHA3_384, SHA512, SHA3_512, blake2b, and blake2s.\n" + RESET)
PassFound = 0
# file selection dialog to select plane text and hash files. Disabled by default.
def select_file(window_title):
# Hide the main Tkinter window (which would otherwise appear as an empty box)
root = tk.Tk()
root.withdraw()
# Open the file selection dialog
file_path = filedialog.askopenfilename(
title=window_title,
initialdir="/", # Optional: start directory
filetypes=(("Text files", "*.txt"), ("All files", "*.*")) # Optional: file filters
)
# Destroy the hidden root window after selection
root.destroy()
# Return the selected file path (as a string)
return file_path
try:
selected_p_file = "p_word_list.txt" #plain text password list
#selected_p_file = select_file("Select plain text password list") # Enable to run the file dialog
# Load plain text Password list. One password per line.
# Password list should contain more sample passwords than the hash list.
with open(selected_p_file, 'r', encoding='utf-8') as file:
p = file.read().splitlines()
#p = [line.rstrip('\n') for line in file]
#print(type(p), p)
selected_h_file = "hash_list.txt" # HASHed passwords list
#selected_h_file = select_file("Select a HASH list") # Enable to run the file dialog
# Load HASH list. One HASH per line.
with open(selected_h_file, 'r', encoding='utf-8') as file:
h = file.read().splitlines()
#print(type(h), h)
except FileNotFoundError:
print("The file does not exist.")
except PermissionError:
print("Permission denied.")
except IsADirectoryError:
print("The path is a directory, not a file.")
except Exception as e:
print(f"An unexpected error occurred: {e}")
# This is for testing
#hash_results = {}
#for item in p:
# # Encode the string to bytes before hashing
# encoded_item = item.encode('utf-8')
# # Create the hash object and get the hexadecimal digest
# hex_digest = hashlib.sha256(encoded_item).hexdigest()
# hash_results[item] = hex_digest
#print(hash_results)
print("Checking HASH's.\n")
# Compare password list with hash list.
for passw in p:
# Update the hash object with the bytes-like object (encoded string)
# utf-8, utf-16, and utf-32
hashMD5_object = hashlib.md5(passw.encode('utf-8')).hexdigest()
hash1_object = hashlib.sha1(passw.encode('utf-8')).hexdigest()
hash224_object = hashlib.sha224(passw.encode('utf-8')).hexdigest()
hash3_224_object = hashlib.sha3_224(passw.encode('utf-8')).hexdigest()
hash256_object = hashlib.sha256(passw.encode('utf-8')).hexdigest()
hash3_256_object = hashlib.sha3_256(passw.encode('utf-8')).hexdigest()
hash384_object = hashlib.sha384(passw.encode('utf-8')).hexdigest()
hash3_384_object = hashlib.sha3_384(passw.encode('utf-8')).hexdigest()
hash512_object = hashlib.sha512(passw.encode('utf-8')).hexdigest()
hash3_512_object = hashlib.sha3_512(passw.encode('utf-8')).hexdigest()
blake2b_object = hashlib.blake2b(passw.encode('utf-8')).hexdigest()
blake2s_object = hashlib.blake2s(passw.encode('utf-8')).hexdigest()
# shake_128_object = hashlib.shake_128(passw.encode('utf-8')).hexdigest(50)
# shake_256_object = hashlib.shake_256(passw.encode('utf-8')).hexdigest(50)
for hashL in h:
if hashMD5_object == hashL:
# Print hash and password
print(f"MD5 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if hash1_object == hashL:
# Print hash and password
print(f"SHA1 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if hash224_object == hashL:
# Print hash and password
print(f"SHA224 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if hash3_224_object == hashL:
# Print hash and password
print(f"SHA3_224 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if hash256_object == hashL:
# Print hash and password
print("SHA256 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if hash3_256_object == hashL:
# Print hash and password
print("SHA3_256 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if hash384_object == hashL:
# Print hash and password
print(f"SHA384 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if hash3_384_object == hashL:
# Print hash and password
print(f"SHA3_384 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if hash512_object == hashL:
# Print hash and password
print(f"SHA512 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if hash3_512_object == hashL:
# Print hash and password
print(f"SHA3_512 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if blake2b_object == hashL:
# Print hash and password
print(f"blake2b hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
if blake2s_object == hashL:
# Print hash and password
print(f"blake2s hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
PassFound += 1
# if shake_128_object == hashL:
# # Print hash and password
# print(f"shake_128 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
# PassFound += 1
#
# if shake_256_object == hashL:
# # Print hash and password
# print(f"shake_256 hash: " + GREEN + f"{hashL}" + RESET + " Password: " + GREEN + f"{passw}" + RESET)
# PassFound += 1
print(f"\nNumber of HASHs checked: {len(h)}")
print(f"{PassFound} Passwords found out of {len(p)} samples.")
#Clean up
p.clear()
h.clear()
Plane text password list:
is
this
working
12345
admin
030101306021
alyjarkar
alysiamarie
Alyssaaj1
a&m100606
am3twrnv
ama7deus
amadousmane
Amaeu4
amagersputnik
amaiconda
amalaqul
amaliamalin
amamuamamu
Amandha6
amanimia5
Sample HASH's:
fa51fd49abf67705d6a35d18218c115ff5633aec1f9ebfdc9d5d4956416f57f6
1eb79602411ef02cf6fe117897015fff89f80face4eccd50425c45149b148408
dd5ace9e018dbd62336cbe039916ad7c817d0e9bc9934f70d67f3ff75544da88
f258c9bc63d7a14914f26b1a7249fe6a4b76d8c9