Skip to main content

EwfIntegrityPath

Struct EwfIntegrityPath 

Source
pub struct EwfIntegrityPath { /* private fields */ }
Expand description

Path-based, mmap-backed EWF integrity analyser.

Unlike EwfIntegrity (which takes &[u8] slices already in memory), EwfIntegrityPath opens segment files and memory-maps them read-only. The OS pages data on demand, so 500 GB evidence files are handled without loading them into RAM.

§Segment auto-discovery

from_path accepts the first segment (evidence.E01 / evidence.e01) and automatically discovers consecutive siblings (E02, E03, … up to EZZ) in the same directory. Pass from_paths to supply the segment list explicitly.

Implementations§

Source§

impl EwfIntegrityPath

Source

pub fn from_path(path: impl AsRef<Path>) -> Self

Analyse a single segment or auto-discover a multi-segment image.

If path has an extension matching the EWF numbered-segment pattern (E01/e01, E02/e02, …) this will look for consecutive siblings in the same directory and include them automatically.

Source

pub fn from_paths(paths: &[impl AsRef<Path>]) -> Self

Analyse an explicit ordered list of segment paths.

Source

pub fn with_expected_md5(self, hash: [u8; 16]) -> Self

Supply an external chain-of-custody MD5 to compare against.

Source

pub fn with_expected_sha1(self, hash: [u8; 20]) -> Self

Supply an external chain-of-custody SHA-1 to compare against.

Source

pub fn with_expected_sha256(self, hash: [u8; 32]) -> Self

Supply an external chain-of-custody SHA-256 to compare against. Mismatch → ExternalSha256Mismatch (Critical).

Source

pub fn compute_hashes(&self) -> Result<Option<ComputedHashes>>

Memory-map every segment and compute sector data hashes.

Returns Err if any segment cannot be opened or mapped. Returns Ok(None) if the image is unparseable or is EWF v2.

Source

pub fn analyse(&self) -> Result<Vec<EwfIntegrityAnomaly>>

Memory-map every segment and run the full integrity analyser.

Returns Err if any segment file cannot be opened or mapped.

Source

pub fn analyse_and_compute_hashes( &self, ) -> Result<(Vec<EwfIntegrityAnomaly>, ComputedHashes)>

Memory-map every segment once and run analysis + hash computation in a single pass, avoiding duplicate I/O compared to calling [analyse] and [compute_hashes] separately.

Returns Err if any segment file cannot be opened or mapped. If the image is too corrupted to compute hashes, a zeroed ComputedHashes is returned alongside the anomalies.

Source

pub fn analyse_with_progress( &self, progress: impl FnMut(AnalysisProgress), ) -> Result<(Vec<EwfIntegrityAnomaly>, ())>

Run integrity analysis while reporting progress to a callback.

Identical to [analyse] but invokes progress after each chunk is processed so callers can display a progress bar for large images.

Returns (anomalies, ()) on success, or Err if a segment cannot be opened or memory-mapped.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.