Byte Entropy

v0.1.0Added Sep 26, 2026Sample data

Shannon entropy over sliding windows of a binary, for spotting packed or encrypted sections.

Sample data. These figures are placeholders, not measurements.

cargo install kura-rs
kura add byte-entropy

Copies the source file into your project. You own the code from then on.

If another tool already installs a kura command, run cargo install kura-rs --bin kura-rs and use kura-rs add instead.

use crate::parts::byte_entropy::windows;

for w in windows(&binary, 4096) {
    if w.entropy > 7.2 {
        println!("offset {:#x}: likely packed ({:.2} bits/byte)", w.offset, w.entropy);
    }
}

Verification

Sample data

Checked against scipy.stats.entropy 1.14 (Python) using property-based testing: the same inputs go to both implementations and the outputs are compared.

Reference
scipy.stats.entropy
Python 1.14
Test cases
4,000
Property-based testing
Passed
4,000 / 4,000
All cases match
Last run
Sep 26, 2026
UTC

These numbers are placeholders. They have not been measured yet and must not be read as real results. This part is marked "sample": true in its registry file.

Benchmarks

Sample data

kura-rs (Rust) against scipy.stats.entropy across input sizes. Faster at every measured input size, up to 35× faster.

These numbers are placeholders. They have not been measured yet and must not be read as real results. This part is marked "sample": true in its registry file.

kura-rs (Rust)scipy.stats.entropy
Wall time per run (lower is better).
Show data table
Input sizekura-rs (Rust)scipy.stats.entropySpeedup
4,0960.01 ms0.35 ms35×
65,5360.09 ms2.9 ms32×
1,048,5761.4 ms44 ms31×
16,777,21622 ms700 ms32×

Files

  • parts/byte_entropy/mod.rs

Crate dependencies

None. Only the standard library.