nirs4all.utils.hashing module
Fast, deterministic content hashing for numpy arrays.
Provides compute_data_hash which hashes the raw bytes of a numpy array
using xxhash (preferred for speed) with a SHA-256 fallback.
- nirs4all.utils.hashing.compute_data_hash(X: ndarray) str[source]
Compute a deterministic hex digest for a numpy array.
Uses xxhash (xxh128) when available for speed, otherwise falls back to SHA-256. The array is made contiguous before hashing so that the result is independent of memory layout.
- Parameters:
X – Numpy array to hash.
- Returns:
Hex digest string.