A simple command line utility for encoding, decoding and hashing files.
Instead of having separate binaries for base32, base64, base85, hex, binary, sha256sum and sha512sum, xtool provides all of them in a single executable.
You can either use it as:
xtool <command>or create symlinks and use it like regular coreutils commands:
base64 file.txt
sha256sum file.txt
hex -d dump.txt- Base32 encode/decode
- Base64 encode/decode
- Base85 encode/decode
- Hex encode/decode
- Binary encode/decode
- SHA-256 checksums
- SHA-512 checksums
- Streaming processing for large files
- Supports stdin and file input
- Coreutils-style symlink dispatch
- Memory-mapped file reads where possible
Build the project:
cargo build --releaseThe binary will be available at:
target/release/xtoolCreate symlinks if you want to call the tool directly as base64, sha256sum, etc.
ln -s /path/to/xtool base32
ln -s /path/to/xtool base64
ln -s /path/to/xtool base85
ln -s /path/to/xtool hex
ln -s /path/to/xtool binary
ln -s /path/to/xtool sha256sum
ln -s /path/to/xtool sha512sumPlace the symlinks anywhere in your PATH.
The binary automatically detects which mode to run based on the name it was started with.
xtool base64 file.txt
xtool base64 -d encoded.txt
xtool base32 file.txt
xtool base32 -d encoded.txt
xtool hex file.bin
xtool hex -d dump.txt
xtool binary file.bin
xtool binary -d bits.txt
xtool sha256sum file.txt
xtool sha512sum file.txtbase64 file.txt
base64 -d encoded.txt
base32 file.txt
base32 -d encoded.txt
hex file.bin
hex -d dump.txt
binary file.bin
binary -d bits.txt
sha256sum file.txt
sha512sum file.txtAll commands support stdin.
Encode:
echo "hello" | xtool base64Decode:
echo "aGVsbG8K" | xtool base64 -dHash:
cat file.txt | xtool sha256sumYou can also pass - explicitly:
cat file.txt | base64 -| Command | Description |
|---|---|
base32 |
Encode or decode Base32 |
base64 |
Encode or decode Base64 |
base85 |
Encode or decode Base85 |
hex |
Encode bytes to hex and decode hex back to bytes |
binary |
Encode bytes to binary and decode binary back to bytes |
sha256sum |
Print SHA-256 checksum |
sha512sum |
Print SHA-512 checksum |
For encoding commands:
-d
--decodeswitches from encoding mode to decoding mode.
xtool base64 image.png > image.b64xtool base64 -d image.b64 > image_restored.pngxtool sha256sum file.txtOutput:
d2a84f4b8b650937ec8f73cd8be2c74add5a911ba64df27458ed8229da804a26 file.txt
xtool sha256sum file1.txt file2.txt file3.txtecho -n "hi" | xtool binaryOutput:
0110100001101001
echo "48656c6c6f" | xtool hex -dOutput:
Hello
- Base32, Base64, Hex, Binary, SHA-256 and SHA-512 operate in streaming mode and process data in chunks.
- Large files can be processed without loading the entire file into memory.
- Base85 currently buffers the whole input because the underlying crate does not provide a streaming API.
- Encode/decode commands accept a single input file or stdin.
- SHA-256 and SHA-512 support multiple input files.
See Cargo.toml
APACHE 2