tropy 0.1.0

Entropy viewer for the command line
Documentation

tropy - command line entropy viewer

Latest Version Documentation License

What is tropy?

The tropy commandline tool takes bytes or input from std in and calculates the Shannon entropy then it display them colour coded in the terminal.

Installing

With Rust installed run:

cargo install tropy

Using the tropy command line tool

# for example to get the entropy of the tropy binary
# in chunks of 1024 bytes (the default value)
tropy target/release/tropy --bytes 1024

will yield something like this: example.png

# or read data from stdin and get the raw entropy as csv
cat /dev/urandom | tropy - --csv

Using tropy as a library

Add this to your Cargo.toml:

#[dependencies]
.
tropy = { version = "0.1.0", default_features = false }
.

And to use the entropy calculator in your program/library add this:

use std::io::Write;
use tropy::Calculator;

let mut calc = Calculator::new();

// write some bytes
calc.write(&[0u8]).unwrap();
calc.write(&[1u8]).unwrap();

// calculate the entropy over the accumulated state
// and reset the calculator
let e = calc.entropy();
assert_eq!(e,1.0);

License

Mozilla Public License 2.0