How to use the xxhash.xxh3_64 function in xxhash

To help you get started, we’ve selected a few xxhash 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 ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
def test_xxh3_64(self):
        self.assertEqual(xxhash.xxh3_64('a').intdigest(), 9860746555294122439)
        self.assertEqual(xxhash.xxh3_64('a', 0).intdigest(), 9860746555294122439)
        self.assertEqual(xxhash.xxh3_64('a', 1).intdigest(), 13320045329392605694)
        self.assertEqual(xxhash.xxh3_64('a', 2**64-1).intdigest(), 14273714421385330224)
github ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
def test_xxh3_64_reset_more(self):
        x = xxhash.xxh3_64()
        h = x.intdigest()

        for i in range(random.randint(100, 200)):
            x.reset()

        self.assertEqual(h, x.intdigest())

        for i in range(10, 1000):
            x.update(os.urandom(i))
        x.reset()

        self.assertEqual(h, x.intdigest())

        for i in range(10, 1000):
            x.update(os.urandom(100))
        x.reset()
github ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
def test_xxh3_64_update(self):
        x = xxhash.xxh3_64()
        x.update('a')
        self.assertEqual(xxhash.xxh3_64('a').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('a'), x.digest())
        x.update('b')
        self.assertEqual(xxhash.xxh3_64('ab').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('ab'), x.digest())
        x.update('c')
        self.assertEqual(xxhash.xxh3_64('abc').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('abc'), x.digest())

        seed = random.randint(0, 2**64)
        x = xxhash.xxh3_64(seed=seed)
        x.update('a')
        self.assertEqual(xxhash.xxh3_64('a', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('a', seed), x.digest())
        x.update('b')
github ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
def test_xxh3_64_reset(self):
        x = xxhash.xxh3_64()
        h = x.intdigest()

        x.update('x' * 10240)
        x.reset()

        self.assertEqual(h, x.intdigest())
github ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
def test_xxh3_64_seed_reset(self):
        seed = random.randint(0, 2**64-1)
        x = xxhash.xxh3_64(seed=seed)
        h = x.intdigest()
        x.update('x' * 10240)
        x.reset()
        self.assertEqual(h, x.intdigest())
github ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
def test_xxh3_64_update(self):
        x = xxhash.xxh3_64()
        x.update('a')
        self.assertEqual(xxhash.xxh3_64('a').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('a'), x.digest())
        x.update('b')
        self.assertEqual(xxhash.xxh3_64('ab').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('ab'), x.digest())
        x.update('c')
        self.assertEqual(xxhash.xxh3_64('abc').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('abc'), x.digest())

        seed = random.randint(0, 2**64)
        x = xxhash.xxh3_64(seed=seed)
        x.update('a')
        self.assertEqual(xxhash.xxh3_64('a', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('a', seed), x.digest())
        x.update('b')
        self.assertEqual(xxhash.xxh3_64('ab', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('ab', seed), x.digest())
        x.update('c')
        self.assertEqual(xxhash.xxh3_64('abc', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('abc', seed), x.digest())
github ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
def test_xxh3_64_update(self):
        x = xxhash.xxh3_64()
        x.update('a')
        self.assertEqual(xxhash.xxh3_64('a').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('a'), x.digest())
        x.update('b')
        self.assertEqual(xxhash.xxh3_64('ab').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('ab'), x.digest())
        x.update('c')
        self.assertEqual(xxhash.xxh3_64('abc').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('abc'), x.digest())

        seed = random.randint(0, 2**64)
        x = xxhash.xxh3_64(seed=seed)
        x.update('a')
        self.assertEqual(xxhash.xxh3_64('a', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('a', seed), x.digest())
        x.update('b')
        self.assertEqual(xxhash.xxh3_64('ab', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('ab', seed), x.digest())
        x.update('c')
        self.assertEqual(xxhash.xxh3_64('abc', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('abc', seed), x.digest())
github ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
self.assertEqual(a.hexdigest(), xxhash.xxh3_64_hexdigest(s, seed=2**64))

        a = xxhash.xxh3_64(s, seed=1)
        b = xxhash.xxh3_64(s, seed=2**64+1)
        self.assertEqual(a.seed, b.seed)
        self.assertEqual(a.intdigest(), b.intdigest())
        self.assertEqual(a.hexdigest(), b.hexdigest())
        self.assertEqual(a.digest(), b.digest())
        self.assertEqual(a.intdigest(), xxhash.xxh3_64_intdigest(s, seed=1))
        self.assertEqual(a.intdigest(), xxhash.xxh3_64_intdigest(s, seed=2**64+1))
        self.assertEqual(a.digest(), xxhash.xxh3_64_digest(s, seed=1))
        self.assertEqual(a.digest(), xxhash.xxh3_64_digest(s, seed=2**64+1))
        self.assertEqual(a.hexdigest(), xxhash.xxh3_64_hexdigest(s, seed=1))
        self.assertEqual(a.hexdigest(), xxhash.xxh3_64_hexdigest(s, seed=2**64+1))

        a = xxhash.xxh3_64(s, seed=2**65-1)
        b = xxhash.xxh3_64(s, seed=2**66-1)
        self.assertEqual(a.seed, b.seed)
        self.assertEqual(a.intdigest(), b.intdigest())
        self.assertEqual(a.hexdigest(), b.hexdigest())
        self.assertEqual(a.digest(), b.digest())
        self.assertEqual(a.intdigest(), xxhash.xxh3_64_intdigest(s, seed=2**65-1))
        self.assertEqual(a.intdigest(), xxhash.xxh3_64_intdigest(s, seed=2**66-1))
        self.assertEqual(a.digest(), xxhash.xxh3_64_digest(s, seed=2**65-1))
        self.assertEqual(a.digest(), xxhash.xxh3_64_digest(s, seed=2**66-1))
        self.assertEqual(a.hexdigest(), xxhash.xxh3_64_hexdigest(s, seed=2**65-1))
        self.assertEqual(a.hexdigest(), xxhash.xxh3_64_hexdigest(s, seed=2**66-1))
github ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
def test_xxh3_64_update(self):
        x = xxhash.xxh3_64()
        x.update('a')
        self.assertEqual(xxhash.xxh3_64('a').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('a'), x.digest())
        x.update('b')
        self.assertEqual(xxhash.xxh3_64('ab').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('ab'), x.digest())
        x.update('c')
        self.assertEqual(xxhash.xxh3_64('abc').digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('abc'), x.digest())

        seed = random.randint(0, 2**64)
        x = xxhash.xxh3_64(seed=seed)
        x.update('a')
        self.assertEqual(xxhash.xxh3_64('a', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('a', seed), x.digest())
        x.update('b')
        self.assertEqual(xxhash.xxh3_64('ab', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('ab', seed), x.digest())
        x.update('c')
        self.assertEqual(xxhash.xxh3_64('abc', seed).digest(), x.digest())
        self.assertEqual(xxhash.xxh3_64_digest('abc', seed), x.digest())
github ifduyue / python-xxhash / tests / test_xxh3_64.py View on Github external
def test_xxh3_64(self):
        self.assertEqual(xxhash.xxh3_64('a').intdigest(), 9860746555294122439)
        self.assertEqual(xxhash.xxh3_64('a', 0).intdigest(), 9860746555294122439)
        self.assertEqual(xxhash.xxh3_64('a', 1).intdigest(), 13320045329392605694)
        self.assertEqual(xxhash.xxh3_64('a', 2**64-1).intdigest(), 14273714421385330224)