Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 784 Bytes

README.md

File metadata and controls

33 lines (26 loc) · 784 Bytes

entropython

A Python module for efficient calculation of Shannon byte entropy based on Rust.

Installation

To install the version from pypi.org run

pip install entropython

To install the latest version directly from GitHub run

pip git+https://github.com/fkie-cad/entropython

(you need to have rust installed) or check out the repository and run

pip install .

Usage

from entropython import shannon_entropy, metric_entropy

byte_str = (
    b'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod ' 
    b'tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.'
)
print(shannon_entropy(byte_str))
print(metric_entropy(byte_str))