All problems
Commitment Opening Check
Problem
Check whether a commitment opens correctly. The commitment scheme is h(value, nonce) = (value * 7919 + nonce) mod 1000003. Return True when the recomputed hash equals the supplied commitment.
Hint
Binding commitments make it infeasible to open with a different value.
Test cases
case 1
in: [42,123,332721]
expected: true
case 2
in: [42,123,332722]
expected: false
case 3
in: [0,0,0]
expected: true
case 4
in: [5,10,1]
expected: false
Starter codePython
def commitment_opens(value, nonce, commitment):
# Your code here
pass4 test cases · run your code against them in the editor