lib/algorithms/hashing_algs.py
def crc32(string, salt=None, front=False, back=False, use_hex=False, **placeholder):
    """
      Create a CRC32 hash from a given string

      > :param string: string to be hashed
      > :return: a CRC32 hash

      Example:
        >>> crc32("test")
        d87f7e0c
        >>> crc32("test", use_hex=True)
        0xd87f7e0cL
    """
    if type(string) is unicode:
        string = lib.settings.force_encoding(string)
    if salt is not None and front and not back:
        long_int = hex(zlib.crc32(salt + string) % 2 ** 32)
    elif salt is not None and back and not front:
        long_int = hex(zlib.crc32(string + salt) % 2 ** 32)
    else:
        long_int = hex(zlib.crc32(string) % 2 ** 32)

    if not use_hex:
        return str(long_int)[2:-1]
    else:
        return long_int

      Create a CRC32 hash from a given string

      > :param string: string to be hashed
      > :return: a CRC32 hash

      Example:
        >>> crc32("test")
        d87f7e0c
        >>> crc32("test", use_hex=True)
        0xd87f7e0cL
    
Create a CRC32 hash from a given string
> :param string: string to be hashed
> :return: a CRC32 hash
Create a CRC32 hash from a given string > : param string : string to be hashed > : return : a CRC32 hash
def crc32(string, salt=None, front=False, back=False, use_hex=False, **placeholder):
    if type(string) is unicode:
        string = lib.settings.force_encoding(string)
    if salt is not None and front and not back:
        long_int = hex(zlib.crc32(salt + string) % 2 ** 32)
    elif salt is not None and back and not front:
        long_int = hex(zlib.crc32(string + salt) % 2 ** 32)
    else:
        long_int = hex(zlib.crc32(string) % 2 ** 32)
    if not use_hex:
        return str(long_int)[2:-1]
    else:
        return long_int
def crc32 ( string , salt = None , front = False , back = False , use_hex = False , ** placeholder ) : if type ( string ) is unicode : string = lib . settings . force_encoding ( string ) if salt is not None and front and not back : long_int = hex ( zlib . crc32 ( salt + string ) % 2 ** 32 ) elif salt is not None and back and not front : long_int = hex ( zlib . crc32 ( string + salt ) % 2 ** 32 ) else : long_int = hex ( zlib . crc32 ( string ) % 2 ** 32 ) if not use_hex : return str ( long_int ) [ 2 : - 1 ] else : return long_int
Create a CRC32 hash from a given string
> :param string: string to be hashed
> :return: a CRC32 hash
Create a CRC32 hash from a given string > : param string : string to be hashed > : return : a CRC32 hash
"""
      Create a CRC32 hash from a given string

      > :param string: string to be hashed
      > :return: a CRC32 hash

      Example:
        >>> crc32("test")
        d87f7e0c
        >>> crc32("test", use_hex=True)
        0xd87f7e0cL
    """
string
salt
front
back
use_hex
examples
None