Skip to main content

Crate pith_digest

Crate pith_digest 

Source
Expand description

The shared vocabulary of the pith suite: the one error type, the fixed-width digest value, the Hamming distance between digests, and the closed sets of names that appear in on-disk records. Also the computational primitives every modality crate shares: SHA-256, the checksums (CRC-32, Adler-32, FNV-1a 64), splitmix64 and the bit reader.

The foundation crate of the zero-dependency pith suite. Every other crate builds on these types and nothing builds beneath them: this crate has an empty [dependencies] table, enforced by scripts/check-zero-deps.py.

The crate is core-only in its library shape: no filesystem, network, clock or environment, and no code path allocates. The std feature (on by default) links std so the cdylib the language SDKs bind through carries a panic handler; the library surface itself stays core-only either way.

Re-exports§

pub use crate::base64::base64_decode;
pub use crate::base64::base64_encode;
pub use crate::xxh64::xxh64;

Modules§

base64
Base64 (RFC 4648), the standard A-Za-z0-9+/ alphabet with = padding.
ffi
The C ABI surface of pith-digest: the entry points the Python (ctypes), Node (koffi) and Go (cgo) SDKs bind through.
xxh64
xxHash64 (XXH64), the 64-bit non-cryptographic hash of the xxHash reference (Cyan4973/xxHash, xxhash.h).

Structs§

BitReader
Reads bit-level fields from a byte slice, never panicking.
Digest
A fixed-width hash value of N bytes.
SplitMix64
A splitmix64 generator (Steele, Lea & Flood 2014).
Xoshiro256StarStar
A xoshiro256** generator (Blackman & Vigna 2018/2019).

Enums§

Algorithm
The hash functions this workspace can produce, so an index record can say what it was computed with.
Error
The single error type of the pith suite.
Format
The container formats the codecs decode.

Traits§

Read
The minimal byte source Digest::from_stream reads from.

Functions§

adler32
Computes the Adler-32 checksum of data (RFC 1950 8.2).
crc32
Computes the reflected CRC-32 of data (PNG spec / ISO 3309).
crc32c
Computes the CRC-32C (Castagnoli) of data (RFC 3720 B.4).
fnv1a64
Computes the 64-bit FNV-1a hash of data.
hamming
The number of differing bits between two digests.
hmac_sha1
Computes the HMAC-SHA-1 of data under key (RFC 2104; vectors RFC 2202).
hmac_sha256
Computes the HMAC-SHA-256 of data under key (RFC 2104; vectors RFC 4231).
hmac_sha512
Computes the HMAC-SHA-512 of data under key (RFC 2104; vectors RFC 4231).
murmur3_x64_128
Computes the 128-bit MurmurHash3 x64 digest of data under seed.
sha1
Computes the SHA-1 digest of data (FIPS 180-4).
sha256
Computes the SHA-256 digest of data (FIPS 180-2).
sha512
Computes the SHA-512 digest of data (FIPS 180-4).

Type Aliases§

Result
The result type used by every fallible operation in the kit. The error type defaults to Error, which is what the kit’s own APIs return; the parameter stays open so host code can reuse the alias with its own error type.