Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 775 Bytes

README.md

File metadata and controls

32 lines (21 loc) · 775 Bytes

entro.py

Simple command-line entropy calculation tool for Python.

The tool can calculate entropy for bits, nybbles, bytes, or Unicode code points. Try with --verbose to see the progress of the calculation.

To use from a library,

from entro import H, Bit, Nybble, Str, Utf8
bit_entropy    = H(Bit(data))
nybble_entropy = H(Nybble(data))
byte_entropy   = H(Str(data))
utf8_entropy   = H(Utf8(data))

History / Credits

Adapted from http://pythonfiddle.com/shannon-entropy-calculation/ which in turn features the following comment:

Stolen from Ero Carrera http://blog.dkbza.org/2007/05/scanning-data-for-entropy-anomalies.html

LICENSE

2-clause BSD license, as generated by the friendly Github repository creator.