Guessing entropy

qif.measure.guessing

Guessing entropy \(G(\pi) = \sum_{i=1}^n i\, \pi_{x_i}\), where \(x_1, \ldots, x_n\) are the secrets in non-increasing order of probability: the expected number of guesses the adversary needs to find the secret, guessing one value at a time in the best order. It is an uncertainty measure.

Functions

prior(pi: ndarray) → FloatOrRat

The guessing entropy \(G(\pi)\).

posterior(pi: ndarray, C: ndarray) → FloatOrRat

The posterior guessing entropy \(G[\pi\triangleright C] = \sum_y p(y)\, G(p_{X|y})\).

add_leakage(pi: ndarray, C: ndarray) → FloatOrRat

The additive leakage \(G(\pi) - G[\pi\triangleright C]\).

mult_leakage(pi: ndarray, C: ndarray) → FloatOrRat

The multiplicative leakage \(G(\pi) / G[\pi\triangleright C]\).