lib/algorithms/hashing_algs.py
def mssql_2005(string, salt=None, **placeholder):
    """
      Create an MsSQL 2005 hash, if not salt is given, salt will be created

      > :param string: string to be hashed
      > :return: a MsSQL 2005 hash

      Example:
        >>> mssql_2005("test", salt="testing")
        0x010074657374696e673f0414438c1b692da8be7a1211a76d314ea0210f
    """
    if type(string) is unicode:
        string = lib.settings.force_encoding(string)

    if salt is None:
        salt = lib.settings.random_salt_generator(use_string=True)[0]
    data_string = "".join(map(lambda s: ("%s\0" if ord(s) < 256 else "%s") % s.encode("utf8"), string))
    obj = hashlib.sha1()
    obj.update(data_string + salt)
    hash_data = obj.hexdigest()
    return "0x0100{}{}".format(salt.encode("hex"), hash_data)

      Create an MsSQL 2005 hash, if not salt is given, salt will be created

      > :param string: string to be hashed
      > :return: a MsSQL 2005 hash

      Example:
        >>> mssql_2005("test", salt="testing")
        0x010074657374696e673f0414438c1b692da8be7a1211a76d314ea0210f
    
Create an MsSQL 2005 hash, if not salt is given, salt will be created
> :param string: string to be hashed
> :return: a MsSQL 2005 hash
Create an MsSQL 2005 hash if not salt is given salt will be created > : param string : string to be hashed > : return : a MsSQL 2005 hash
def mssql_2005(string, salt=None, **placeholder):
    if type(string) is unicode:
        string = lib.settings.force_encoding(string)
    if salt is None:
        salt = lib.settings.random_salt_generator(use_string=True)[0]
    data_string = "".join(map(lambda s: ("%s\0" if ord(s) < 256 else "%s") % s.encode("utf8"), string))
    obj = hashlib.sha1()
    obj.update(data_string + salt)
    hash_data = obj.hexdigest()
    return "0x0100{}{}".format(salt.encode("hex"), hash_data)
def mssql_2005 ( string , salt = None , ** placeholder ) : if type ( string ) is unicode : string = lib . settings . force_encoding ( string ) if salt is None : salt = lib . settings . random_salt_generator ( use_string = True ) [ 0 ] data_string = "" . join ( map ( lambda s : ( "%s\0" if ord ( s ) < 256 else "%s" ) % s . encode ( "utf8" ) , string ) ) obj = hashlib . sha1 ( ) obj . update ( data_string + salt ) hash_data = obj . hexdigest ( ) return "0x0100{}{}" . format ( salt . encode ( "hex" ) , hash_data )
Create an MsSQL 2005 hash, if not salt is given, salt will be created
> :param string: string to be hashed
> :return: a MsSQL 2005 hash
Create an MsSQL 2005 hash if not salt is given salt will be created > : param string : string to be hashed > : return : a MsSQL 2005 hash
"""
      Create an MsSQL 2005 hash, if not salt is given, salt will be created

      > :param string: string to be hashed
      > :return: a MsSQL 2005 hash

      Example:
        >>> mssql_2005("test", salt="testing")
        0x010074657374696e673f0414438c1b692da8be7a1211a76d314ea0210f
    """
string
salt
examples
None