Skip to content

Instantly share code, notes, and snippets.

@mrT4ntr4
Created April 21, 2020 19:39
Show Gist options
  • Save mrT4ntr4/128b6aae28a39bb5f521c9e400c48013 to your computer and use it in GitHub Desktop.
Save mrT4ntr4/128b6aae28a39bb5f521c9e400c48013 to your computer and use it in GitHub Desktop.
Trying decryption of hash for Challenge SharpPasswd.dll from VolgaCTF 2020 (Unsolved)
dd = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
get_bin = lambda x: format(x, 'b').zfill(6)
enc = "h3dly.DhgeOUeicweL2Zp."
n = 4
enc = [enc[i:i+n] for i in range(0, len(enc), n)]
#print enc
i=0
hash = [None] * 16
for chunk in enc:
lol = ''
for x in chunk[::-1]:
lol += get_bin(dd.find(x))
res = int(lol,2)
if(i < 4):
hash[i] = res & 0xff
hash[i+6] = (res >> 8) & 0xff
hash[i+12] = (res >> 16) & 0xff
elif(i==4):
#print res & 0xff, (res >> 8) & 0xff,(res >> 16) & 0xff
hash[4] = res & 0xff
hash[10] = (res >> 8) & 0xff
hash[5] = (res >> 16) & 0xff
else:
hash[11] = res & 0xff
i += 1
hash = ''.join(['{:02x}'.format(x) for x in hash])
print hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment