ent-rs

Crates.ioent-rs
lib.rsent-rs
version0.1.1
created_at2025-05-23 18:58:31.87517+00
updated_at2025-05-23 19:30:48.548089+00
descriptionEntropy and randomness analysis tool for binary files (Rust port of ent.hpp)
homepage
repositoryhttps://github.com/chbtoys/ent-rs
max_upload_size
id1686619
size21,590
Carl H. Blomqvist (chbtoys)

documentation

https://docs.rs/ent-rs

README

crates.io docs.rs CI

ent-rs

ent-rs is a Rust library for analyzing the entropy and randomness characteristics of binary data. It is a Rust port and extension of the functionality from HÃ¥kan Blomqvist's ent.hpp.

It is useful for evaluating:

  • Compression potential
  • Statistical randomness
  • Distribution uniformity
  • Pseudorandom number generators
  • Data quality or obfuscation

Features

  • Byte and bit mode entropy analysis
  • Chi-square test and p-value
  • Arithmetic mean
  • Monte Carlo Pi estimation
  • Serial correlation
  • Value frequency tables

Usage

Add to your Cargo.toml:

ent-rs = "0.1"

Example

use ent_rs::EntStats;
let data = std::fs::read("mydata.bin").unwrap();
let stats = EntStats::from_data(&data, false);
println!("Entropy: {:.4}", stats.entropy);
Commit count: 14

cargo fmt