diff options
Diffstat (limited to 'nizk/commit')
-rw-r--r-- | nizk/commit/commit.go | 6 | ||||
-rw-r--r-- | nizk/commit/commit_test.go | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/nizk/commit/commit.go b/nizk/commit/commit.go index c2a6848..d044077 100644 --- a/nizk/commit/commit.go +++ b/nizk/commit/commit.go @@ -50,13 +50,13 @@ func commitment(a, b *Scalar, plus bool) *Commitment { } } -func (s *Statement) Commit(id *Point) *Commitment { +func (s *Statement) Commit(id Bytes) *Commitment { s.Commitment.Proof = s.Proof(id) return s.Commitment } type Proof struct { - Id *Point + Id Bytes A *schnorr.Proof // Proof for knowledge of a in A = G^a B *schnorr.Proof // Proof for knowledge of b in B = G^b C struct { // Proof for knowledge of statement above @@ -65,7 +65,7 @@ type Proof struct { } } -func (s *Statement) Proof(id *Point) *Proof { +func (s *Statement) Proof(id Bytes) *Proof { var e [2][2]*Point var r1, r2, w *Scalar r1 = Curve.RandomScalar() diff --git a/nizk/commit/commit_test.go b/nizk/commit/commit_test.go index de5d22e..8763706 100644 --- a/nizk/commit/commit_test.go +++ b/nizk/commit/commit_test.go @@ -19,6 +19,8 @@ func TestStatement(t *testing.T) { if !c2.Verify() { t.Fatal("Could not verify st2 with c2, plus=false case") } + + // Use the wrong proof c2.Proof = c1.Proof if c2.Verify() { t.Fatal("Verify with wrong proof should have failed!") |