Skip to main content

Crate turbo_tasks_hash

Crate turbo_tasks_hash 

Source
Expand description

Hashing and encoding functions for turbopack.

An example use of this module is hashing a file’s content for cache invalidation, and encoding the hash to a base38 or hexadecimal string for use in a file name.

Structs§

ShaHasher
Xxh3Hash64Hasher
Xxh3Hash64 hasher.
Xxh3Hash128Hasher
Xxh3Hash128 hasher.

Enums§

HashAlgorithm

Constants§

BASE38_LEN_64
Number of base38 characters needed to represent a 64-bit value without information loss.
BASE38_LEN_128
Number of base38 characters needed to represent a 128-bit value without information loss.

Traits§

DeterministicHash
Signals the implementor can safely be hashed in a replicatable way across platforms and process runs.
DeterministicHasher
Signals the implementor can safely hash in a replicatable way across platforms and process runs.

Functions§

deterministic_hash
Hash input with algorithm. If salt is non-empty it is written into the hasher before the content so the two are mixed in a single pass — never as a hash-of-hash composition. An empty salt produces the same result as hashing without a prefix.
encode_base38
Encodes a 64-bit unsigned integer into a fixed-width 13-character base38 string.
encode_base64
Encodes a 64-bit unsigned integer into a base64 string (11 chars, no padding).
encode_base38_128
Encodes a 128-bit unsigned integer into a fixed-width 25-character base38 string.
encode_hex
Encodes a 64-bit unsigned integer into a hex string.
encode_hex_128
Encodes a 128-bit unsigned integer into a hex string.
hash_xxh3_hash64
Hash some content with the Xxh3Hash64 non-cryptographic hash function.
hash_xxh3_hash128
Hash some content with the Xxh3Hash128 non-cryptographic hash function.

Derive Macros§

DeterministicHash