The File Integrity Library is a Rust crate designed to help you calculate MD5 hashes for files and generate JSON reports of the file integrity status. This can be useful for verifying the integrity of files in a list, such as during software distribution or system monitoring.
Add this crate to your Cargo.toml:
toml
[dependencies]
file_integrity = "0.1.2"
```rust use fileintegrity::hashfile;
fn main() { let filename = "path/to/your/file.txt".tostring(); let result = hashfile(filename.clone()); println!("Filename: {}", result.filename); println!("MD5 Hash: {}", result.md5_hash); } ```
```rust use fileintegrity::hashfile_list;
fn main() { let filename = "path/to/your/filelist.txt"; let filelist = hashfilelist(filename); println!("Date: {}", filelist.date); println!("Number of Files: {}", filelist.files.len()); } ```
```rust use fileintegrity::{hashfilelist, writejson_file};
fn main() { let filename = "path/to/your/filelist.txt"; let filelist = hashfilelist(filename); writejsonfile(&file_list); } ```