not coded by me...im copy and pasting to be helpful, and the word "I" dose not refer to me but the person how posted it.
a quick (as in i made it quickly, it's not particularly quick ;P) md5 cracking class. I made it for part of a bigger project which I am real excited about, but I can't tell you about it yet :D
I changed the charlist to a-z because it broke the frame, you can add chars to the variable 'self.charlist' inside_init_
a quick (as in i made it quickly, it's not particularly quick ;P) md5 cracking class. I made it for part of a bigger project which I am real excited about, but I can't tell you about it yet :D
I changed the charlist to a-z because it broke the frame, you can add chars to the variable 'self.charlist' inside_init_
Code
import hashlib
class crack :
#by yipyipchompchomp
def __init__(self) :
self.charlist = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
self.charlen = len(self.charlist);
self.hash = {};
self.crackedHash = "";
self.stop = False;
def perm(self,n) : #permutation, only called by comb
for i in range(1,n) :
n = n*i;
return n;
def comb(self,r) : #combination, gets all possible combinations
return self.perm(self.charlen)/(self.perm(r)*self.perm(self.charlen-r));
def crackHash(self,m,h) : # sets md5 to crack
self.unknownHash = h;
self.max = m-1;
self.num = 0;
self.crackedHash = "";
for i in range(0,m) : # sets hash dict
self.hash[i] = "";
self.brute(self.max-self.num)
def checkHash(self,h) : #only called by brute
hashstring = "";
for i in h:
hashstring += h[i];
if hashlib.md5(hashstring).hexdigest() == self.unknownHash :
self.crackedHash = hashstring;
self.stop=True;
def brute(self,n): #only called by crackHash
if self.stop!=True :
if n == self.max-self.num:
for i in range(0,self.charlen):
self.hash[self.max-n] = self.charlist[i];
self.brute(n-1);
elif n>0 :
for i in range(0,self.charlen):
self.hash[self.max-n] = self.charlist[i];
self.brute(n-1);
else:
for i in range(0,self.charlen):
self.hash[self.max-n] = self.charlist[i];
self.checkHash(self.hash);
#example implementation
c = crack();
for i in range(1,8) :
if c.crackedHash == "" :
print i,c.comb(i);
c.crackHash(i,"900150983cd24fb0d6963f7d28e17f72");
else :
print c.crackedHash;
break;[img]http://i685.photobucket.com/albums/vv215/blackpearl4/THANKS.gif[/img]
If You Like this tutorial, please check out my other tutorials by clicking ==> H3R3
PHP & .NET Contributor.

