Skip to content

Instantly share code, notes, and snippets.

@mrkurt
Created November 6, 2008 22:50
Show Gist options
  • Save mrkurt/22730 to your computer and use it in GitHub Desktop.
Save mrkurt/22730 to your computer and use it in GitHub Desktop.
import hashlib
from base64 import b64decode, b64encode
def utf16tobin(s):
return s.encode('hex')[4:].decode('hex')
b64salt = "kDP0Py2QwEdJYtUX9cJABg=="
b64hash = "OJF6H4KdxFLgLu+oTDNFodCEfMA="
binsalt = b64decode(b64salt)
password_string = 'password'.encode("utf16")
password_string = utf16tobin(password_string)
print password_string
m1 = hashlib.sha1()
# Pass in salt
m1.update(binsalt + password_string)
# Pass in password
# B64 encode the binary digest
if b64encode(m1.digest()) == b64hash:
print "Logged in!"
else:
print "Didn't match"
print b64hash
print b64encode(m1.digest())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment