Skip to Content
oxcrypto

TupleHash

Hash a sequence of byte strings with TupleHash or TupleHashXOF.

from oxcrypto.xof.tuple_hash import TUPLE_HASH

algorithm = TUPLE_HASH.TUPLE_HASH256
output = algorithm.digest([b"user", b"example.org"], 64, customization=b"My App")

digest takes an iterable of bytes items and hashes them as one tuple, so [b"ab", b"c"] and [b"a", b"bc"] give different outputs. It has no digest_chunks, because each item is a tuple element rather than a chunk of one message.

TUPLE_HASH128 and TUPLE_HASH256 absorb the output length, so a 16-byte output is not a prefix of a 32-byte one. TUPLE_HASH_XOF128 and TUPLE_HASH_XOF256 are the TupleHashXOF variants, whose shorter outputs are prefixes of longer ones.

StandardNIST SP 800-185 section 5 (Final)
Cratetuple-hash 0.6.0 (Eric Lagergren, BSD-3-Clause), pre-1.0 release
DependenciesBuilt on sha3 0.10 / digest 0.10 / keccak 0.1, an older RustCrypto stack used only inside this wrapper
AuditNo published audit
MSRV1.85, builds with the project MSRV 1.88
ExperimentalNo
Test vectorsNIST SP 800-185 TupleHash and TupleHashXOF samples