All problems
Privacy Amplification Bits
Problem
Return the number of secure bits produced by privacy amplification:
max(0, min_entropy - leaked - 2 * log2(1 / epsilon))
where min_entropy is the min-entropy the eavesdropper does not know, leaked is the number of exposed bits, and epsilon the desired statistical security parameter.
Hint
A smaller epsilon costs two extra bits per decade of security.
Test cases
case 1
in: [10,2,0.001]
expected: 0
case 2
in: [20,2,0.01]
expected: 4.712287620450551
case 3
in: [8,0,0.5]
expected: 6
case 4
in: [5,4,0.1]
expected: 0
Starter codePython
import math
def privacy_amplification_bits(min_entropy, leaked, epsilon):
# Your code here
pass4 test cases · run your code against them in the editor