Another unpronounceable tool.
Swap bytes using patterns and masks.
USAGE:
bswp-cli [OPTIONS] -e <pattern>...
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-i <input> input path (if not provided STDIN is used instead)
-o <output> output path (if not provided STDOUT is used instead)
-e <pattern>... pattern: <value>,<mask>,<periodicity>,<offset>
Replace every other bytes by 0x42
(displayed as B
).
echo -n "AAAA" | bswp-cli -e 0x42,0xFF,2,0
result:
BABA
Replace every other 4 bytes groups by 0x52555354
(displayed as RUST
)
echo -n "AAAABBBBCCCCDDDD" | bswp-cli -e 0x52,0xFF,8,0 -e 0x55,0xFF,8,1 -e 0x53,0xFF,8,2 -e 0x54,0xFF,8,3
result:
RUSTBBBBRUSTDDDD
Run tests with cargo test
.
Clone and build from source:
git clone https://github.com/PicoJr/bswp-cli.git
cd bswp-cli
cargo build --release
yes | head -c 100MiB | ./target/release/bswp-cli -e 0x6e,0xFF,2,1 | pv > /dev/null
100MiB 0:00:00 [ 147MiB/s] [ <=>
pattern(s) | throughput |
---|---|
1 | ~150MiB/s |
2 | ~75MiB/s |
3 | ~50MiB/s |
4 | ~40MiB/s |
Please see the CHANGELOG for a release history.