Created
November 6, 2008 22:50
-
-
Save mrkurt/22730 to your computer and use it in GitHub Desktop.
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
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