-
-
Save pyaephyohein/816aee68d103a0ed3d75cd0ed181e22e to your computer and use it in GitHub Desktop.
Python MD5 decrypt.
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| import hashlib | |
| import sys | |
| import time | |
| # Using: ./hash.py hashcode | |
| # For example: ./hash.py 9743a66f914cc249efca164485a19c5c | |
| def timing(f): | |
| def wrap(*args): | |
| time1 = time.time() | |
| ret = f(*args) | |
| time2 = time.time() | |
| print '%s Time: %0.3f s' % (f.func_name, float(time2 - time1)) | |
| return ret | |
| return wrap | |
| @timing | |
| 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