rust-file is a small Rust command-line archive tool. It packs the files in a
directory into a custom archive format, compresses the archive with zstd, and
encrypts it with XChaCha20-Poly1305 using a key derived from your password with
Argon2.
It also includes simple TCP send/receive commands and UDP discovery helpers for finding a receiver on the local network.
This is an experimental project. Be careful with real data.
Important: encrypt --dir <directory_path> deletes the source directory after it
writes the encrypted archive.
cargo buildFor an optimized binary:
cargo build --releaseRun tests and lints:
cargo test
cargo clippy --all-targets --all-featuresShow help by running the binary without a valid command:
cargo run --cargo run -- encrypt --dir <directory_path>The program asks for:
- a password
- a zstd compression level from
-7to22
It writes an archive named like:
mole_<uuid>.bin
After writing the archive, the source directory is removed.
cargo run -- decrypt <archive_path> [output_directory]If output_directory is omitted, files are restored into the current directory.
The sender can send the encrypted archive after creating it:
cargo run -- encrypt --dir <directory_path> --send <host:port>Example:
cargo run -- encrypt --dir ./secret --send 192.168.1.20:9000On the receiving machine:
cargo run -- receive <host:port>Example:
cargo run -- receive 0.0.0.0:9000The received bytes are written to a generated mole_*.bin archive file.
Discovery uses UDP port 9001.
On the receiver, advertise a file name and the TCP address where it can receive:
cargo run -- serve-discovery <file_name> <host:port>Example:
cargo run -- serve-discovery backup.bin 192.168.1.20:9000On another machine, search for that receiver:
cargo run -- find-receiver <file_name>Example:
cargo run -- find-receiver backup.binIf a matching receiver answers within 3 seconds, the command prints the receiver address.
The encrypted file contains:
- 16-byte random salt
- 24-byte random nonce
- encrypted zstd-compressed archive bytes
Inside the compressed archive, metadata is written in little-endian fields, followed by file names, relative paths, and file contents.
Apache License 2.0. See LICENSE.