file_intergity

Crates.io

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.

Features

Installation

Add this crate to your Cargo.toml:

toml [dependencies] file_integrity = "0.1.2"

Usage

Hashing a Single File

```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); } ```

Hashing Files from a List

```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()); } ```

Writing JSON Reports

```rust use fileintegrity::{hashfilelist, writejson_file};

fn main() { let filename = "path/to/your/filelist.txt"; let filelist = hashfilelist(filename); writejsonfile(&file_list); } ```