4 releases
| 0.1.3 | Mar 1, 2025 |
|---|---|
| 0.1.2 | May 7, 2024 |
| 0.1.1 | Mar 16, 2024 |
| 0.1.0 | Mar 16, 2024 |
#1188 in Cryptography
234 downloads per month
30KB
557 lines
Sapphire Hash
A recursive, performant hash calculator written in Rust!
| Command-line Tool | Graphical User Interface |
|---|---|
Usage (GUI)
Download the app from the releases page, extract it an run it.
Usage (CLI)
Install Rust and Cargo: https://rustup.rs/
Install the app with:
cargo install sapphire-hash
Run with:
sapphire-hash --algorithm <ALGORITHM> <DIRECTORY>
Where:
DIRECTORYcan be either the relative or the full path to the desired directory or file.ALGORITHMis the desired hash algorithm. Only algorithms implemented by OpenSSL are available:md5sha1sha224sha256sha384sha512sha3_224sha3_256sha3_384sha3_512shake128shake256ripemd160sm3
Optionally, you can add an --output <OUTPUT_PATH> to specify the output. End the file in .csv to generate a CSV report.
Logging
You may also enable logging by using the RUST_LOG=trace environment variable.
If you want to pipe the results and log results to separate files, you may use:
RUST_LOG=trace sapphire-hash --algorithm ALGORITHM DIRECTORY | tee result.txt 2>/dev/stdout | tee log.txt
Development
Dependencies
- Rust (https://rustup.rs/)
- Build Tools:
- Ubuntu:
build-essential
- Ubuntu:
- OpenSSL:
- Ubuntu:
sudo apt install libssl-dev - Windows: Use vcpkg and install by running:
vcpkg install openssl - MacOS: Install pkg-config:
brew install pkg-config
- Ubuntu:
- Flutter and other native dependencies for GUI development (see flutter_gui/README.md)
Setup
Clone the repository.
If you're on Windows you might need to specify the path to OpenSSL using the OPENSSL_DIR environment variable. This is the path that has the lib\ and include\ folders. You can do this by running:
# Windows only
$env:OPENSSL_DIR="C:\path_to_vckpg\packages\openssl_x64-windows"
Run cargo build.
Use the app like so:
./target/debug/sapphire-hash --algorithm ALGORITHM DIRECTORY
Building for Production
Run:
OPENSSL_STATIC=true cargo build --release
Use the app like so:
./target/release/sapphire-hash --algorithm ALGORITHM DIRECTORY
Running Automated Tests
Run:
cargo test
Creating Files for Manual Testing
Use the script for creating random files: scripts/generate_example_files.sh
Check the script code for available options.
Linting
Run:
RUSTFLAGS=-Dwarnings cargo clippy --all-targets --all-features
GUI Development
Whenever you update the flutter_bridge project, be sure to run the codegen so that the Flutter project picks up the changes. Inside gui_flutter, run:
flutter_rust_bridge_codegen generate
See more about GUI development in flutter_gui/README.md
Dependencies
~8–22MB
~239K SLoC