Skip to main content

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

Project description

entropython

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

Installation

Just run

pip install entropython

Usage

from entropython import shannon_entropy, metric_entropy

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

Build from Source

For building the binary from source, Rust needs to be installed.

Run

cargo build --release
mv target/release/libentropython.so entropython.so # The renaming is necessary for Python to find the module
# Optional: Remove debug symbols from the binary to dramatically reduce its size.
strip entropython.so

The built entropython.so itself has no dependencies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

entropython-1.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (174.4 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

entropython-1.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (174.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

entropython-1.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (174.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

entropython-1.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (174.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

entropython-1.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (174.5 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page