A simple Rust program to verify file hash integrity.
This program allows a user to:
- View all files in the current directory.
- Input the name of a file and its expected hash.
- Calculate hashes for the chosen file using various algorithms:
- MD5
- SHA-1
- SHA-3
- SHA-256
- Blake2
- CRC32
- Compare the calculated hashes to the user's expected hash.
- Highlight matches, and verify the file if any match. Otherwise, display a warning.
- Current Path Detection: Display the current working directory path.
- File Listing: Lists all files in the current directory.
- User Input: Takes in a file name and its expected hash.
- Hash Verification: Verifies against several algorithms:
- MD5
- SHA-1
- SHA-3
- SHA-256
- Blake2
- CRC32
- A
utils
module is necessary, providing utility functions like file listing and hash calculation.
- Compile and run the program.
- It displays all files in the current directory.
- Enter the file name to check.
- Input the expected hash for the file.
- Program displays calculated hashes for various algorithms.
- Verification message is shown if there's a match; otherwise, a warning appears.
- Uses ANSI escape codes for colored terminal output.
- Ensure the
utils
module is in the same project.
- Rust and Cargo. If not installed, get them from Rust's official website.
- Compile: Navigate to the project directory and compile with:
cargo build --release
- Run: Execute the program using:
cargo run