MCPcopy Create free account
hub / github.com/sqlmapproject/sqlmap / mssql_new_passwd

Function mssql_new_passwd

lib/utils/hash.py:149–164  ·  view source on GitHub ↗

Reference(s): http://hashcat.net/forum/thread-1474.html https://sqlity.net/en/2460/sql-password-hash/ >>> mssql_new_passwd(password='testpass', salt='4086ceb6', uppercase=False) '0x02004086ceb6eb051cdbc5bdae68ffc66c918d4977e592f6bdfc2b444a7214f71fa31c35902c5b7ae773ed5f4

(password, salt, uppercase=False)

Source from the content-addressed store, hash-verified

147 return retVal.upper() if uppercase else retVal.lower()
148
149def mssql_new_passwd(password, salt, uppercase=False): # since version '2012'
150 """
151 Reference(s):
152 http://hashcat.net/forum/thread-1474.html
153 https://sqlity.net/en/2460/sql-password-hash/
154
155 >>> mssql_new_passwd(password='testpass', salt='4086ceb6', uppercase=False)
156 '0x02004086ceb6eb051cdbc5bdae68ffc66c918d4977e592f6bdfc2b444a7214f71fa31c35902c5b7ae773ed5f4c50676d329120ace32ee6bc81c24f70711eb0fc6400e85ebf25'
157 """
158
159 binsalt = decodeHex(salt)
160 unistr = b"".join((_.encode(UNICODE_ENCODING) + b"\0") if ord(_) < 256 else _.encode(UNICODE_ENCODING) for _ in password)
161
162 retVal = "0200%s%s" % (salt, sha512(unistr + binsalt).hexdigest())
163
164 return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
165
166def mssql_passwd(password, salt, uppercase=False): # versions '2005' and '2008'
167 """

Callers

nothing calls this directly

Calls 1

decodeHexFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…