Python binding for xxHash library providing fast non-cryptographic hash algorithms
Overall
score
80%
Evaluation — 80%
↑ 1.03xAgent success when using this tile
You need to build a hash seed validator tool that verifies whether two seed values will produce identical hash outputs for the same input data. This tool should handle seeds of any size and determine if they are equivalent after normalization.
Your implementation should include:
A function are_seeds_equivalent_32(seed1: int, seed2: int) -> bool that:
True if both seeds would produce identical hash outputs when used with a 32-bit hash algorithmFalse otherwiseA function are_seeds_equivalent_64(seed1: int, seed2: int) -> bool that:
True if both seeds would produce identical hash outputs when used with a 64-bit hash algorithmFalse otherwiseA function normalize_seed(seed: int, bit_size: int) -> int that:
Provides fast non-cryptographic hash functions with seed support.
# File: test_validator.py
from validator import are_seeds_equivalent_32
def test_basic_32bit_equivalence():
# Seeds that overflow to the same value
assert are_seeds_equivalent_32(0, 2**32)
assert are_seeds_equivalent_32(5, 2**32 + 5)
assert are_seeds_equivalent_32(100, 2**64 + 100)
# Seeds that are different
assert not are_seeds_equivalent_32(0, 1)
assert not are_seeds_equivalent_32(100, 200)# File: test_validator.py
from validator import are_seeds_equivalent_64
def test_basic_64bit_equivalence():
# Seeds that overflow to the same value
assert are_seeds_equivalent_64(0, 2**64)
assert are_seeds_equivalent_64(42, 2**64 + 42)
# Seeds that are different
assert not are_seeds_equivalent_64(0, 1)
assert not are_seeds_equivalent_64(1000, 2000)# File: test_validator.py
from validator import normalize_seed
def test_seed_normalization():
# 32-bit normalization
assert normalize_seed(2**32, 32) == 0
assert normalize_seed(2**32 + 10, 32) == 10
# 64-bit normalization
assert normalize_seed(2**64, 64) == 0
assert normalize_seed(2**64 + 100, 64) == 100validator.pytest_validator.pyInstall with Tessl CLI
npx tessl i tessl/pypi-xxhashdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10