Skip to content

Instantly share code, notes, and snippets.

@haxelion
Created March 24, 2015 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haxelion/8db00f041669c972c5a4 to your computer and use it in GitHub Desktop.
Save haxelion/8db00f041669c972c5a4 to your computer and use it in GitHub Desktop.
EXPECTED = "8D4516AC19DE394BECF3A816DED7D3FC"
SALT = "aRgDsHyUjGkzgRvdfDFVhtTJqVCD"
import md5
import sha
import base64
import itertools
import string
def custom_hash(password):
plain = password + SALT
hashed = plain
for i in range(100):
hashed = md5.new(hashed).digest()
for i in range(150):
hashed = sha.new(hashed).digest()
hashed = base64.b64encode(hashed)
hashed = hashed.encode('rot13')
for i in range(50):
hashed = md5.new(hashed).digest()
return hashed.encode('hex').upper()
def bruteforce(charset, maxlength):
return (''.join(candidate)
for candidate in itertools.chain.from_iterable(itertools.product(charset, repeat=i)
for i in range(1, maxlength + 1)))
for attempt in bruteforce(string.ascii_lowercase, 10):
hashed = custom_hash(attempt)
if hashed == EXPECTED:
print attempt
break
# 50 * md5 ( rot13 ( base64encode ( 150 * sha1( 100 * md5 ( plaintext + salt ) ) ) ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment