(password, salt, uppercase=True)
return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
Reference(s):
        www.exploit-db.com/download_pdf/15537/
        http://www.leidecker.info/projects/phrasendrescher/mssql.c
        https://www.evilfingers.com/tools/GSAuditor.php

    >>> mssql_old_passwd(password='testpass', salt='4086ceb6', uppercase=True)
    '0x01004086CEB60C90646A8AB9889FE3ED8E5C150B5460ECE8425AC7BB7255C0C81D79AA5D0E93D4BB077FB9A51DA0'
Reference(s):
        www.exploit-db.com/download_pdf/15537/
        http://www.leidecker.info/projects/phrasendrescher/mssql.c
        https://www.evilfingers.com/tools/GSAuditor.php
Reference ( s ) : www . exploit - db . com / download_pdf / 15537 / http : // www . leidecker . info / projects / phrasendrescher / mssql . c https : // www . evilfingers . com / tools / GSAuditor . php
def mssql_old_passwd(password, salt, uppercase=True):  # prior to version '2005'
    """
    Reference(s):
        www.exploit-db.com/download_pdf/15537/
        http://www.leidecker.info/projects/phrasendrescher/mssql.c
        https://www.evilfingers.com/tools/GSAuditor.php

    >>> mssql_old_passwd(password='testpass', salt='4086ceb6', uppercase=True)
    '0x01004086CEB60C90646A8AB9889FE3ED8E5C150B5460ECE8425AC7BB7255C0C81D79AA5D0E93D4BB077FB9A51DA0'
    """

    binsalt = hexdecode(salt)
    unistr = "".join(map(lambda c: ("%s\0" if ord(c) < 256 else "%s") % utf8encode(c), password))

    retVal = "0100%s%s%s" % (salt, sha1(unistr + binsalt).hexdigest(), sha1(unistr.upper() + binsalt).hexdigest())

    return "0x%s" % (retVal.upper() if uppercase else retVal.lower())
def mssql_old_passwd ( password , salt , uppercase = True ) : # prior to version '2005' binsalt = hexdecode ( salt ) unistr = "" . join ( map ( lambda c : ( "%s\0" if ord ( c ) < 256 else "%s" ) % utf8encode ( c ) , password ) ) retVal = "0100%s%s%s" % ( salt , sha1 ( unistr + binsalt ) . hexdigest ( ) , sha1 ( unistr . upper ( ) + binsalt ) . hexdigest ( ) ) return "0x%s" % ( retVal . upper ( ) if uppercase else retVal . lower ( ) )