All problems
Nonce Reuse Count
Problem
Given a list of nonces, return how many distinct nonce values were used more than once. Even a single reuse breaks stream cipher confidentiality.
Hint
The count is over distinct values, not over extra occurrences.
Test cases
case 1
in: [[1,2,3]]
expected: 0
case 2
in: [[1,1,2]]
expected: 1
case 3
in: [[1,1,2,2,3]]
expected: 2
case 4
in: [[5,5,5,5]]
expected: 1
Starter codePython
def nonce_reuse_count(nonces):
# Your code here
pass4 test cases · run your code against them in the editor