From 0ada8c47427bfe604024d383ed7a250b04c82fee Mon Sep 17 00:00:00 2001 From: Özgür Kesim Date: Thu, 21 Nov 2024 17:13:47 +0100 Subject: refactor: lifted nizk/ up and away --- nizk/commit_test.go | 57 ----------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 nizk/commit_test.go (limited to 'nizk/commit_test.go') diff --git a/nizk/commit_test.go b/nizk/commit_test.go deleted file mode 100644 index 909d010..0000000 --- a/nizk/commit_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package nizk - -import ( - "testing" - - . "kesim.org/seal/common" -) - -func TestStatement(t *testing.T) { - id := Curve.RandomScalar() - - b1 := NewBit(id, true) - b2 := NewBit(id, false) - - if !b1.Commitment.Verify(id, b1.Proof) { - t.Fatal("Could not verify st1 with c1, plus=true case") - } - if !b2.Commitment.Verify(id, b2.Proof) { - t.Fatal("Could not verify st2 with c2, plus=false case") - } - - // Use the wrong proof - if b2.Commitment.Verify(id, b1.Proof) { - t.Fatal("Verify with wrong proof should have failed!") - } - - // Use wrong id - x := Curve.RandomScalar() - if b1.Commitment.Verify(x, b1.Proof) || b2.Commitment.Verify(x, b2.Proof) { - t.Fatal("Verify with wrong id should have failed!") - } -} - -func TestStatementFromScalar(t *testing.T) { - var α, β, id = Curve.RandomScalar(), Curve.RandomScalar(), Curve.RandomScalar() - - b1 := NewBitFromScalars(id, true, α, β) - b2 := NewBitFromScalars(id, false, α, β) - - if !b1.Commitment.Verify(id, b1.Proof) { - t.Fatal("Could not verify st1 with c1, plus=true case") - } - if !b2.Commitment.Verify(id, b2.Proof) { - t.Fatal("Could not verify st2 with c2, plus=false case") - } - - // Use the wrong proof - if b2.Commitment.Verify(id, b1.Proof) { - t.Fatal("Verify with wrong proof should have failed!") - } - - // Use the wrong Id - x := Curve.RandomScalar() - 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