pub enum Algorithm {
Sha1,
Sha256,
Sha512,
Blake3,
Md5,
XxHash64,
FastCdc,
Perceptual,
Unknown,
}Expand description
Variants§
Sha1
SHA-1. 20-byte digests.
Sha256
SHA-2 with a 256-bit state. 32-byte digests.
Sha512
SHA-2 with a 512-bit state. 64-byte digests.
Blake3
BLAKE3 with the default 32-byte output.
Md5
MD5. 16-byte digests.
XxHash64
xxHash64. 8-byte digests.
FastCdc
FastCDC content-defined chunking. 4-byte digests: the 32-bit Gear fingerprint at the cut point, the width the FastCDC reference implementation produces.
Perceptual
A perceptual hash. The width is a property of the modality
(image, audio, video, text), so
output_len is None.
Unknown
A name written by a future version of this kit. A record carrying it can still be read; it just cannot be recomputed here.
Implementations§
Source§impl Algorithm
impl Algorithm
Sourcepub fn from_str(s: &str) -> Self
pub fn from_str(s: &str) -> Self
Parses the wire form. An unrecognised string yields
Algorithm::Unknown, never an error, so records written by a
future version stay readable. Matching is exact and
case-sensitive: "SHA256" is Unknown.
Sourcepub fn output_len(&self) -> Option<usize>
pub fn output_len(&self) -> Option<usize>
Digest width in bytes for the fixed-width members; None for
Perceptual, whose width is a property
of the modality, and for Unknown.