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.
| Standard | NIST SP 800-185 section 5 (Final) |
| Crate | tuple-hash 0.6.0 (Eric Lagergren, BSD-3-Clause), pre-1.0 release |
| Dependencies | Built on sha3 0.10 / digest 0.10 / keccak 0.1, an older RustCrypto stack used only inside this wrapper |
| Audit | No published audit |
| MSRV | 1.85, builds with the project MSRV 1.88 |
| Experimental | No |
| Test vectors | NIST SP 800-185 TupleHash and TupleHashXOF samples |