aboutsummaryrefslogtreecommitdiff
path: root/nizk/commit_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'nizk/commit_test.go')
-rw-r--r--nizk/commit_test.go24
1 files changed, 12 insertions, 12 deletions
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!")
}
}