diff options
author | Özgür Kesim <oec@codeblau.de> | 2024-11-15 12:55:28 +0100 |
---|---|---|
committer | Özgür Kesim <oec@codeblau.de> | 2024-11-15 12:55:28 +0100 |
commit | 77a567048b4d820e22c0a3653d9f82fb96598738 (patch) | |
tree | e00563a3dc34d96d79fe7f84a215c33dca9ca342 /nizk/stage1.go | |
parent | 9d5358deb9cb52c850e91a282b27e98545f34ee6 (diff) |
stage2 now works; tests pass
Diffstat (limited to 'nizk/stage1.go')
-rw-r--r-- | nizk/stage1.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/nizk/stage1.go b/nizk/stage1.go index ee1be2c..453d683 100644 --- a/nizk/stage1.go +++ b/nizk/stage1.go @@ -69,10 +69,26 @@ func (b *Bit) StageFromScalars(x, r *Scalar) (c *StageCommitment) { func (b *Bit) reveal(prev_true bool, Xs ...*Point) (r *StageReveal) { s := b.Stage - // TODO: Calculate Y based on the Xs and our own X_i + // Calculate Y based on the Xs and our own X_i // as Π_(i<k) X_k / Π_(i>k) X_k - // For now: - Y := G + // (basically leaving our own X_i out in the calculation). + // We are assuming that Xs is ordered already. + Y := Curve.Identity() + found := false + for _, X := range Xs { + if !found && X.Equal(b.Stage.X) { + found = true + continue + } + if !found { + Y = Y.Mul(X) + } else { + Y = Y.Div(X) + } + } + if !found { + panic("own X not found in Xs") + } r = &StageReveal{Y: Y} |