How to use the mmh3.hash128 function in mmh3

To help you get started, we’ve selected a few mmh3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hajimes / mmh3 / test_mmh3.py View on Github external
def test_hash128():
    assert mmh3.hash128('foo') == 168394135621993849475852668931176482145
    assert mmh3.hash128('foo', 42) == 215966891540331383248189432718888555506
    assert mmh3.hash128('foo', 42, signed = False) == 215966891540331383248189432718888555506
    assert mmh3.hash128('foo', 42, signed = True) == -124315475380607080215185174712879655950
    # TODO
github hajimes / mmh3 / test_mmh3.py View on Github external
def test_hash128():
    assert mmh3.hash128('foo') == 168394135621993849475852668931176482145
    assert mmh3.hash128('foo', 42) == 215966891540331383248189432718888555506
    assert mmh3.hash128('foo', 42, signed = False) == 215966891540331383248189432718888555506
    assert mmh3.hash128('foo', 42, signed = True) == -124315475380607080215185174712879655950
    # TODO
github hajimes / mmh3 / test_mmh3.py View on Github external
def test_hash128():
    assert mmh3.hash128('foo') == 168394135621993849475852668931176482145
    assert mmh3.hash128('foo', 42) == 215966891540331383248189432718888555506
    assert mmh3.hash128('foo', 42, signed = False) == 215966891540331383248189432718888555506
    assert mmh3.hash128('foo', 42, signed = True) == -124315475380607080215185174712879655950
    # TODO
github hajimes / mmh3 / test_mmh3.py View on Github external
def test_hash128():
    assert mmh3.hash128('foo') == 168394135621993849475852668931176482145
    assert mmh3.hash128('foo', 42) == 215966891540331383248189432718888555506
    assert mmh3.hash128('foo', 42, signed = False) == 215966891540331383248189432718888555506
    assert mmh3.hash128('foo', 42, signed = True) == -124315475380607080215185174712879655950
    # TODO
github pankaj28843 / html2latex / src / html2latex / html2latex.py View on Github external
def hash_string(s):
    return "html2latex_{version}_{mmh3_hash}_{hmac_of_sha512_hash}".format(
        version=VERSION,
        mmh3_hash=mmh3.hash128(s),
        hmac_of_sha512_hash=hmac.new(hashlib.sha512(s).hexdigest()).hexdigest(),
    )
github worldveil / bloompy / bloompy / __init__.py View on Github external
def _hash(self, item):
        bloom = 0
        for salt in self.salts:
            bloom |= (1L << (mmh3.hash128(salt + str(item)) % self.m))
        return bloom
github pandemicsyn / stalker / stalkerweb / stalkerweb / stutils.py View on Github external
def genPrimaryKey64(data):
    return "%x" % (mmh3.hash128(data) & 0xFFFFFFFFFFFFFFFF)
github mozilla / OpenWPM / automation / Proxy / mitm_commands.py View on Github external
except zlib.error as e:
            logger.error('BROWSER %i: Received zlib error when trying to decompress gzipped javascript: %s' % (browser_params['crawl_id'],str(e)))
            return
    elif 'deflate' in content_encoding[0].lower():
        try:
            script = zlib.decompress(msg.response.content, -zlib.MAX_WBITS)
        except zlib.error as e:
            logger.error('BROWSER %i: Received zlib error when trying to decompress deflated javascript: %s' % (browser_params['crawl_id'],str(e)))
            return
    else:
        logger.error('BROWSER %i: Received Content-Encoding %s. Not supported by Firefox, skipping archive.' % (browser_params['crawl_id'], str(content_encoding)))
        return
    script = encode_to_unicode(script)

    # Hash script for deduplication on disk
    hasher = mmh3.hash128
    script_hash = str(hasher(script.encode('utf-8')) >> 64)

    ldb_socket.send((script, script_hash))

    return script_hash

mmh3

Python extension for MurmurHash (MurmurHash3), a set of fast and robust hash functions.

MIT
Latest version published 2 months ago

Package Health Score

88 / 100
Full package analysis