Created
December 20, 2014 10:01
-
-
Save coffeewasmyidea/32744e6c52dd175f24b2 to your computer and use it in GitHub Desktop.
Simple example of decrypt md5 (slowly)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import hashlib | |
import sys | |
def decryptMD5(testHash): | |
s = [] | |
while True: | |
m = hashlib.md5() | |
for c in s: | |
m.update(chr(c)) | |
hash = m.hexdigest() | |
if hash == testHash: | |
return ''.join([chr(c) for c in s]) | |
wrapped = True | |
for i in range(0, len(s)): | |
s[i] = (s[i] + 1) % 256 | |
if s[i] != 0: | |
wrapped = False | |
break | |
if wrapped: | |
s.append(0) | |
print decryptMD5(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment