#[non_exhaustive]pub enum ExpectedHash {
Whole {
algorithm: HashAlgorithm,
hash: Vec<u8>,
},
Blocks {
algorithm: HashAlgorithm,
block_size: u64,
hashes: Vec<Vec<u8>>,
},
}Expand description
Expected hash spec for a single file.
Either a single whole-file digest, or a fixed-block-size digest per block.
Block-mode is what FFXIV patch lists actually carry for .dat files
(50 MiB blocks), because it pinpoints which block is bad. Whole-file
mode is the natural fit for small files (e.g. .index files), where a
single mismatched bit is best surfaced as a single failure.
§Stability
#[non_exhaustive] — future hash-spec shapes may be added without a
SemVer break.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Whole
Whole-file hash mode: a single algorithm digest over the full file.
Fields
algorithm: HashAlgorithmHash algorithm used.
Blocks
Block-mode hash: file is split into block_size-byte chunks, each
hashed independently. The last block may be shorter than block_size.
Implementations§
Source§impl ExpectedHash
impl ExpectedHash
Sourcepub fn whole_sha1(hash: Vec<u8>) -> Self
pub fn whole_sha1(hash: Vec<u8>) -> Self
Construct a whole-file SHA1 spec from a 20-byte digest.
Sourcepub fn blocks_sha1(block_size: u64, hashes: Vec<Vec<u8>>) -> Self
pub fn blocks_sha1(block_size: u64, hashes: Vec<Vec<u8>>) -> Self
Construct a block-mode SHA1 spec.
Sourcepub fn algorithm(&self) -> HashAlgorithm
pub fn algorithm(&self) -> HashAlgorithm
Hash algorithm in use.
Trait Implementations§
Source§impl Clone for ExpectedHash
impl Clone for ExpectedHash
Source§fn clone(&self) -> ExpectedHash
fn clone(&self) -> ExpectedHash
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExpectedHash
impl Debug for ExpectedHash
Source§impl PartialEq for ExpectedHash
impl PartialEq for ExpectedHash
Source§fn eq(&self, other: &ExpectedHash) -> bool
fn eq(&self, other: &ExpectedHash) -> bool
self and other values to be equal, and is used by ==.