aboutsummaryrefslogtreecommitdiff
path: root/commitment/commitment.go
diff options
context:
space:
mode:
authorÖzgür Kesim <oec@kesim.org>2024-03-22 14:13:41 +0100
committerÖzgür Kesim <oec@kesim.org>2024-03-22 14:13:41 +0100
commitb331bec4ea79d70c78e378ce5e1c1e88dbb89661 (patch)
tree616e4030ce461e366b75f724b6ed1efcfd51c3fa /commitment/commitment.go
parent4490545ebf701ceecbe0f4f7c5cfbe374c476cb4 (diff)
commitment: first steps for SEAL
Diffstat (limited to 'commitment/commitment.go')
-rw-r--r--commitment/commitment.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/commitment/commitment.go b/commitment/commitment.go
new file mode 100644
index 0000000..31de03a
--- /dev/null
+++ b/commitment/commitment.go
@@ -0,0 +1,50 @@
+// Implements the data structures and methods for
+// creating a commitment for the SEAL protocol
+package commitment
+
+import (
+ "kesim.org/seal/curve"
+)
+
+type Scalar = curve.Curve25519Scalar
+type Point = curve.Curve25519Point
+
+var Curve = curve.Curve25519
+
+type Bidder struct {
+ private struct {
+ id *Scalar
+ }
+ Id *Point
+}
+
+type Bid struct {
+ Bidder *Point
+ zbid uint64 // bigendian encoding of the bid
+ bits []Bit // derived from zbid
+}
+
+type Bit struct {
+ id *Scalar
+ v bool
+ x *Scalar
+ r *Scalar
+ e *BitCommitment
+}
+
+type BitCommitment struct {
+ Id *Point
+ XRV *Point
+ X *Point
+ R *Point
+
+ Proofs struct {
+ X *Proof
+ R *Proof
+ }
+}
+
+type Proof struct {
+ PV *Point `json:"V"`
+ Sr *Scalar `json:"r"`
+}