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 base40 or hexadecimal string for use in a file name.
Structs§
- ShaHasher
- Xxh3
Hash64 Hasher - Xxh3Hash64 hasher.
- Xxh3
Hash128 Hasher - Xxh3Hash128 hasher.
Enums§
Constants§
- BASE40_
LEN_ 64 - Number of base40 characters needed to represent a 64-bit value without information loss.
- BASE40_
LEN_ 128 - Number of base40 characters needed to represent a 128-bit value without information loss.
Traits§
- Deterministic
Hash - Signals the implementor can safely be hashed in a replicatable way across platforms and process runs.
- Deterministic
Hasher - Signals the implementor can safely hash in a replicatable way across platforms and process runs.
Functions§
- deterministic_
hash - encode_
base40 - Encodes a 64-bit unsigned integer into a fixed-width 13-character base40 string.
- encode_
base64 - Encodes a 64-bit unsigned integer into a base64 string (11 chars, no padding).
- encode_
base40_ 128 - Encodes a 128-bit unsigned integer into a fixed-width 25-character base40 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.