Expand description
Tensor Checksum Engine
Computes and verifies checksums for tensor data to detect corruption during storage or transmission. Supports multiple pure-Rust checksum algorithms with a stateful engine that tracks per-tensor records and verification stats.
§Algorithms
| Algorithm | Width | Speed | Use-case |
|---|---|---|---|
Fnv1a64 | 64-bit | Fast | General-purpose, non-cryptographic hash |
Adler32 | 32-bit | Fast | Data integrity, used in zlib |
Fletcher16 | 16-bit | Fast | Lightweight embedded / small payloads |
XorFold | 64-bit | Fastest | Ultra-fast, low-collision large tensors |
§Examples
use ipfrs_tensorlogic::tensor_checksum::{
ChecksumAlgorithm, TensorChecksumEngine,
};
let mut engine = TensorChecksumEngine::new();
let data = b"hello tensor world";
let record = engine.compute(1, "layer0".to_string(), data, ChecksumAlgorithm::Fnv1a64, 0);
assert!(record.is_valid(data));
let ok = engine.verify(1, data).expect("example: should succeed in docs");
assert!(ok);Structs§
- Checksum
Engine Stats - Aggregate statistics for a
TensorChecksumEngineinstance. - Checksum
Record - Associates a
TensorChecksumwith a specific tensor and layer name. - Tensor
Checksum - A checksum value together with the metadata needed to re-verify data later.
- Tensor
Checksum Engine - Stateful engine that manages per-tensor checksum records.
Enums§
- Checksum
Algorithm - Checksum algorithm selection.
Functions§
- adler32
- Adler-32 checksum (pure Rust).
- fletcher16
- Fletcher-16 checksum (pure Rust).
- fnv1a64
- Compute the FNV-1a 64-bit hash over arbitrary bytes.
- xor_
fold - XOR-fold checksum.