in hancitor/hancitor.py [0:0]
def estimate_shannon_entropy(data: bytes) -> float:
m = len(data)
bases = collections.Counter([tmp_base for tmp_base in data])
shannon_entropy_value: float = 0.0
for base in bases:
n_i = bases[base]
p_i = n_i / float(m)
entropy_i = p_i * (math.log(p_i, 2))
shannon_entropy_value += entropy_i
return shannon_entropy_value * -1