Git Product home page Git Product logo

bswp-cli's Introduction

BSWP-CLI

Another unpronounceable tool.

Swap bytes using patterns and masks.

Usage

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

Tests

Run tests with cargo test.

Build From Source

Clone and build from source:

git clone https://github.com/PicoJr/bswp-cli.git
cd bswp-cli
cargo build --release

Performances

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

Changelog

Please see the CHANGELOG for a release history.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.