1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//! Rust library for reading and writing Expert Witness Format forensic images.
//!
//! `ewf_image` provides direct Rust APIs for working with Expert Witness Format
//! images. It can open physical, logical, SMART, and EWF2 segment families,
//! expose metadata and stored hashes, read the logical media stream, walk
//! logical single-file catalogs, and create EWF output. CLI and mount layers
//! are not currently implemented.
//!
//! # Terminology
//!
//! Logical media size is the decoded byte length exposed by [`Image::media_size`]
//! and [`ImageInfo::logical_size`]. Segment set size is the total byte length of
//! the opened EWF container files, as reported by [`Image::segment_set_size`].
//! Chunks are the stored allocation units used by EWF tables. Logical EWF
//! images can also contain a single-file catalog, where each entry describes a
//! file-like object stored inside the image.
//!
//! # Supported container families
//!
//! - EWF1 physical `.E01` / EVF images.
//! - EWF1 logical `.L01` / LVF images.
//! - EWF1 SMART `.S01` images.
//! - EWF2 physical `.Ex01` images.
//! - EWF2 logical `.Lx01` images.
//!
//! # Reading
//!
//! ```no_run
//! use std::io::Read;
//!
//! fn main() -> ewf_image::Result<()> {
//! let image = ewf_image::Image::open("case.E01")?;
//! let info = image.info();
//!
//! println!("{:?}: {} bytes", info.format, info.logical_size);
//! println!("segments: {}", image.number_of_segments());
//!
//! let mut sector = vec![0; 512];
//! image.cursor().read_exact(&mut sector)?;
//!
//! let mut later_sector = vec![0; 512];
//! image.read_at(&mut later_sector, 4096)?;
//!
//! Ok(())
//! }
//! ```
//!
//! # Metadata and hashes
//!
//! ```no_run
//! fn main() -> ewf_image::Result<()> {
//! let image = ewf_image::Image::open("case.E01")?;
//!
//! if let Some(case_number) = image.header_value("case_number") {
//! println!("case: {case_number}");
//! }
//!
//! if let Some(md5) = image.hash_value("MD5") {
//! println!("stored MD5: {md5}");
//! }
//!
//! #[cfg(feature = "verify")]
//! {
//! let verification = image.verify()?;
//! println!("MD5 match: {:?}", verification.md5_match);
//! println!("SHA1 match: {:?}", verification.sha1_match);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! # Writing
//!
//! ```no_run
//! use std::fs::File;
//!
//! fn main() -> ewf_image::Result<()> {
//! let mut input = File::open("disk.raw")?;
//!
//! let mut options = ewf_image::WriteOptions::default();
//! options.format = ewf_image::WriteFormat::Ewf2Physical;
//! options.compression = ewf_image::WriteCompression::Zlib;
//! options.metadata.set_header_value("case_number", "CASE-001");
//!
//! let mut writer = ewf_image::EwfWriter::create("case.Ex01", options)?;
//! std::io::copy(&mut input, &mut writer)?;
//! writer.finish()?;
//!
//! Ok(())
//! }
//! ```
//!
//! # Feature flags
//!
//! - `verify` is enabled by default and adds `Image::verify()` plus
//! `VerifyResult` for streamed MD5/SHA1 verification. Stored hash parsing,
//! EWF2 section integrity checks, and writer hash support are available
//! without this feature.
//! - `external-fixtures` enables ignored integration tests that require local
//! EWF corpora and external EWF tools. It does not change library behavior.
//!
//! # Limitations
//!
//! Encrypted EWF2 images are detected and rejected, but decryption and
//! encrypted writing are not implemented. Secondary/shadow target mirroring is
//! supported by the file-backed writer. Base-plus-overlay delta/shadow images
//! are not implemented.
pub use ;
pub use ;
pub use ;
pub use SINGLE_FILE_PATH_SEPARATOR;
pub use ;
pub use ;
pub use VerifyResult;