Skip to content

Instantly share code, notes, and snippets.

@arcolife
Forked from nsa-yoda/gist:5321031
Created September 5, 2013 16:44
Show Gist options
  • Save arcolife/6452805 to your computer and use it in GitHub Desktop.
Save arcolife/6452805 to your computer and use it in GitHub Desktop.
# Takes a user input, hashes it with MD5 crypt, and attempts to match it via brute force
import hashlib, time
md = hashlib.md5()
print("Welcome to a brute force MD5 cracker. \n")
password = input("Enter a password, composed of a number up to 99,999,999: ")
md.update(str(password).encode("utf-8"))
hashed_password = md.hexdigest()
print("Attempting to crack it via brute force increment")
start_time = time.time()
for i in range(99999999):
md = hashlib.md5()
md.update(str(i).encode("utf-8"))
hashed_total_int = md.hexdigest()
if hashed_total_int == hashed_password:
print("Your password is " + str(i))
break;
elapsed_time = time.time() - start_time
print("Elapsed time: " + str(elapsed_time) + " seconds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment