#[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 ==.impl Eq for ExpectedHash
impl StructuralPartialEq for ExpectedHash
Auto Trait Implementations§
impl Freeze for ExpectedHash
impl RefUnwindSafe for ExpectedHash
impl Send for ExpectedHash
impl Sync for ExpectedHash
impl Unpin for ExpectedHash
impl UnsafeUnpin for ExpectedHash
impl UnwindSafe for ExpectedHash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more