#xor #iter #stdio #streaming #iterator

no-std bin+lib xorstream

Utility for xoring a vector of data with an (optionally async) stream of data

3 stable releases

2.0.2 Nov 29, 2019
1.0.0 Oct 12, 2019

#1357 in Encoding

GPL-3.0-or-later

11KB
236 lines

xorstream

Utility for transforming an input stream to an output stream with a bytewise xor transform applied.

As an installed executable, takes a vector of 4, 5, or 6 bit wide (hex, 32, 64) which then pipes from stdin to stdout.

As a dependency it exposes a Transformer and a XorIter or XorStream. Transformer takes a vector of bytes and an impl Read. The Transformer implements IntoIter or IntoStream depending on features = [ "std" ] or features = [ "stream" ].

Installing with x86_64-unknown-linux-musl (for example) can increase the rate it occurs greatly.

$ cargo install xorstream --features bin --target x86_64-unknown-linux-musl

Example:

$ yes 0 | cargo run --features bin --release --target x86_64-unknown-linux-musl -- -4 714b

This pipes AAAAAAAAAAAAAAAAAAAAA infinitely to stdout, using std xorstream.


lib.rs:

xorstream

Utility crate to xor readable data with more readable data.

In the command line version, it takes a xor property (hex, base32, base64), takes input from stdin and streams to stdout. Only possible errors are those of an argument, input, and output errors.

Dependencies

~0–11MB
~98K SLoC