123456789101112131415 |
- def mssql_new_passwd(password, salt, uppercase=False):
- """
- Reference(s):
- http://hashcat.net/forum/thread-1474.html
- >>> mssql_new_passwd(password='testpass', salt='4086ceb6', uppercase=False)
- '0x02004086ceb6eb051cdbc5bdae68ffc66c918d4977e592f6bdfc2b444a7214f71fa31c35902c5b7ae773ed5f4c50676d329120ace32ee6bc81c24f70711eb0fc6400e85ebf25'
- """
- binsalt = hexdecode(salt)
- unistr = "".join(map(lambda c: ("%s\0" if ord(c) < 256 else "%s") % utf8encode(c), password))
- retVal = "0200%s%s" % (salt, sha512(unistr + binsalt).hexdigest())
- return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
|