Crate file_integrity
source ·Expand description
File Integrity Library
file_integrity
is a Rust library that provides functions for ensuring the integrity of files.
This library allows you to calculate MD5 hashes of file contents, generate JSON reports of file hashes, and more. It is designed to help developers verify the integrity of files in various scenarios.
Usage
To use this library, add it as a dependency in your Cargo.toml
:
[dependencies]
file_integrity = "0.1"
Then, you can import and use the functions provided by the library in your code.
Examples
use file_integrity::{list_files, hash_file_list, write_json_file} ;
fn main() {
let folder_path = "~/" ;
let nbs_of_file = list_files(&folder_path);
println!("INFOS: Number of files: {nbs_of_file}");
let hashs = hash_file_list();
let name = "output.json" ;
write_json_file(&hashs, &name);
}
For more detailed information and examples, refer to the documentation of individual functions and modules.
License
This project is licensed under the terms of the MIT license.
For further details, please refer to the LICENSE file.
Contributing
Contributions to this library are welcome! Please follow the guidelines outlined in the CONTRIBUTING file.
Structs
Functions
- Calculates the hash of a given input string.
- Calculate the hash of a file’s contents.
- Calculate hashes for a list of files from a text file.
- Recursively list files in a directory and write their paths to a text file.
- Write a
FileList
struct to a JSON file.