Bayes vulnerability¶
qif.measure.bayes_vuln
Bayes vulnerability \(V_1(\pi) = \max_x \pi_x\) is the probability that the adversary guesses the secret correctly in one try.
Functions¶
- prior(pi: ndarray) FloatOrRat¶
The Bayes vulnerability \(V_1(\pi) = \max_x \pi_x\).
- posterior(pi: ndarray, C: ndarray) FloatOrRat¶
The posterior Bayes vulnerability \(V_1[\pi\triangleright C]\), that is the sum of the column maxima of the joint matrix \(\sum_y \max_x \pi_x C_{x,y}\).
- add_leakage(pi: ndarray, C: ndarray) FloatOrRat¶
The additive Bayes leakage \(\mathcal L^+_1(\pi, C) = V_1[\pi\triangleright C] - V_1(\pi)\).
- mult_leakage(pi: ndarray, C: ndarray) FloatOrRat¶
The multiplicative Bayes leakage \(\mathcal L^\times_1(\pi, C) = V_1[\pi\triangleright C] / V_1(\pi)\).
- min_entropy_leakage(pi: ndarray, C: ndarray) float¶
The min-entropy leakage \(\log_2 \mathcal L^\times_1(\pi, C)\) (in bits).
- mult_capacity(C: ndarray) FloatOrRat¶
The multiplicative Bayes capacity \(\mathcal{ML}^\times_1(\mathbb D, C) = \max_\pi \mathcal L^\times_1(\pi, C)\), equal to the sum of the column maxima \(\sum_y \max_x C_{x,y}\) (always achieved by the uniform prior).
- strategy(pi: ndarray, C: ndarray) ndarray¶
The optimal guess for each observation: an array whose element \(y\) is the \(x\) maximizing \(\pi_x C_{x,y}\).