A fast and efficient CLI tool for calculating SHA256, SHA1, and MD5 hashes of files with progress indication and colored output. Optimized for performance with streaming support for large files.
- Multiple hash algorithms: SHA256, MD5, SHA1, or all at once
- Streaming support: Efficiently processes large files without loading them into memory
- Hash verification: Verify files against known hash values
- Progress bars: Visual feedback for files larger than 10MB
- Colored output: Easy-to-read terminal output
- Multiple files: Process multiple files in a single command
cargo install file-hashergit clone https://github.com/marcuspat/file-hasher
cd file-hasher
cargo install --path .- Rust 1.70 or later
- Works on Linux, macOS, and Windows
Hash a single file with SHA256 (default):
file-hasher file.txtHash multiple files at once:
file-hasher file1.txt file2.txt file3.txtChoose a specific hash algorithm:
file-hasher --algorithm md5 file.txt
file-hasher --algorithm sha1 file.txt
file-hasher --algorithm sha256 file.txtCalculate all hash types at once:
file-hasher --algorithm all file.txtVerify a file against a known hash:
file-hasher --verify dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f file.txtVerify with a specific algorithm:
file-hasher --algorithm md5 --verify 65a8e27d8879283831b664bd8b7f0ad4 file.txt# Hash a large file (shows progress bar)
$ file-hasher large-video.mp4
File: large-video.mp4
SHA256: a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456
# Hash multiple files with all algorithms
$ file-hasher --algorithm all doc1.pdf doc2.pdf
File: doc1.pdf
SHA256: 123abc...
MD5: 456def...
SHA1: 789ghi...
File: doc2.pdf
SHA256: abc123...
MD5: def456...
SHA1: ghi789...
# Verify a downloaded file
$ file-hasher --verify expected_hash_here download.zip
✓ MATCH: Hash verification for 'download.zip'
Expected: expected_hash_here
Computed: expected_hash_herecargo testcargo clippy -- -D warnings
cargo fmt -- --checkThe project includes GitHub Actions workflows that run on every push and pull request:
- Run all tests
- Check code with clippy
- Verify code formatting
File Hasher is optimized for speed and memory efficiency:
- Streaming: Processes files in chunks, using minimal memory regardless of file size
- Progress indication: Automatic progress bars for files larger than 10MB
- Multi-algorithm efficiency: When using
--algorithm all, file is read only once - Benchmarks: Can hash a 1GB file in under 3 seconds on modern hardware (SHA256)
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.