From de44f1a28bc8d14f5ae1aecc11edc0624a330ec4 Mon Sep 17 00:00:00 2001 From: Özgür Kesim Date: Fri, 15 Nov 2024 10:57:43 +0100 Subject: simplify NewBit signature --- nizk/commit_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'nizk/commit_test.go') diff --git a/nizk/commit_test.go b/nizk/commit_test.go index a09ae70..909d010 100644 --- a/nizk/commit_test.go +++ b/nizk/commit_test.go @@ -9,24 +9,24 @@ import ( func TestStatement(t *testing.T) { id := Curve.RandomScalar() - _, c1, p1 := NewBit(id, true) - _, c2, p2 := NewBit(id, false) + b1 := NewBit(id, true) + b2 := NewBit(id, false) - if !c1.Verify(id, p1) { + if !b1.Commitment.Verify(id, b1.Proof) { t.Fatal("Could not verify st1 with c1, plus=true case") } - if !c2.Verify(id, p2) { + if !b2.Commitment.Verify(id, b2.Proof) { t.Fatal("Could not verify st2 with c2, plus=false case") } // Use the wrong proof - if c2.Verify(id, p1) { + if b2.Commitment.Verify(id, b1.Proof) { t.Fatal("Verify with wrong proof should have failed!") } // Use wrong id x := Curve.RandomScalar() - if c1.Verify(x, p1) || c2.Verify(x, p2) { + if b1.Commitment.Verify(x, b1.Proof) || b2.Commitment.Verify(x, b2.Proof) { t.Fatal("Verify with wrong id should have failed!") } } @@ -34,24 +34,24 @@ func TestStatement(t *testing.T) { func TestStatementFromScalar(t *testing.T) { var α, β, id = Curve.RandomScalar(), Curve.RandomScalar(), Curve.RandomScalar() - _, c1, p1 := NewBitFromScalars(id, true, α, β) - _, c2, p2 := NewBitFromScalars(id, false, α, β) + b1 := NewBitFromScalars(id, true, α, β) + b2 := NewBitFromScalars(id, false, α, β) - if !c1.Verify(id, p1) { + if !b1.Commitment.Verify(id, b1.Proof) { t.Fatal("Could not verify st1 with c1, plus=true case") } - if !c2.Verify(id, p2) { + if !b2.Commitment.Verify(id, b2.Proof) { t.Fatal("Could not verify st2 with c2, plus=false case") } // Use the wrong proof - if c2.Verify(id, p1) { + if b2.Commitment.Verify(id, b1.Proof) { t.Fatal("Verify with wrong proof should have failed!") } // Use the wrong Id x := Curve.RandomScalar() - if c1.Verify(x, p1) || c2.Verify(x, p2) { + if b1.Commitment.Verify(x, b2.Proof) || b2.Commitment.Verify(x, b2.Proof) { t.Fatal("Verify with wrong id should have failed!") } } -- cgit v1.2.3