tropy - command line entropy viewer
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:
# 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]
.
= { = "0.1.0", = false }
.
And to use the entropy calculator in your program/library add this:
use Write;
use Calculator;
let mut calc = new;
// write some bytes
calc.write.unwrap;
calc.write.unwrap;
// calculate the entropy over the accumulated state
// and reset the calculator
let e = calc.entropy;
assert_eq!;