aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖzgür Kesim <oec@codeblau.de>2024-03-21 19:20:36 +0100
committerÖzgür Kesim <oec@codeblau.de>2024-03-21 19:20:36 +0100
commit8eeb35615f0483e21dc48f96877a2681cf48b1ec (patch)
tree46a1d6f92cca10cc5d7585e5fa85fedfaaece119
parent00c59198893ba034fda5dda167bed495a7d4649f (diff)
curve: simplify interface - no additive formulation
-rw-r--r--curve/curve.go10
-rw-r--r--curve/ed25519.go4
2 files changed, 8 insertions, 6 deletions
diff --git a/curve/curve.go b/curve/curve.go
index a194cde..75626bd 100644
--- a/curve/curve.go
+++ b/curve/curve.go
@@ -26,7 +26,7 @@ type ScalarReader[S any] interface {
ScalarFromBytes([]byte) (S, error)
}
-type MultiplicativeCurve[S SomeScalar[s], s Data, P MPoint[S, s, p], p Data] interface {
+type SomeCurve[S SomeScalar[s], s Data, P SomePoint[S, s, p], p Data] interface {
ScalarReader[S]
Identity() P
@@ -35,7 +35,7 @@ type MultiplicativeCurve[S SomeScalar[s], s Data, P MPoint[S, s, p], p Data] int
Exp(S) P
}
-type MPoint[S SomeScalar[s], s Data, P Data] interface {
+type SomePoint[S SomeScalar[s], s Data, P Data] interface {
Mult(P) P
Div(P) P
Inv() P
@@ -43,7 +43,8 @@ type MPoint[S SomeScalar[s], s Data, P Data] interface {
Equal(P) bool
}
-// For additive formulation of the curve, use these interfaces:
+/* Additive fomulation of a curve is not needed for now.
+
type AdditiveCurve[S SomeScalar[s], s Data, P APoint[S, s, p], p Data] interface {
ScalarReader[S]
Zero() P
@@ -58,4 +59,5 @@ type APoint[S SomeScalar[s], s Data, P Data] interface {
Neg(P) P
ScalarMult(S) P
Equal(P) bool
-} \ No newline at end of file
+}
+*/ \ No newline at end of file
diff --git a/curve/ed25519.go b/curve/ed25519.go
index e8e380d..6d7e1a0 100644
--- a/curve/ed25519.go
+++ b/curve/ed25519.go
@@ -20,9 +20,9 @@ type c25519 struct{}
type scalar ed.Scalar
type point ed.Point
-var _ MPoint[*scalar, *scalar, *point] = (*point)(nil)
-var _ MultiplicativeCurve[*scalar, *scalar, *point, *point] = Curve25519
var _ SomeScalar[*scalar] = (*scalar)(nil)
+var _ SomePoint[*scalar, *scalar, *point] = (*point)(nil)
+var _ SomeCurve[*scalar, *scalar, *point, *point] = Curve25519
var b64 = base64.StdEncoding.WithPadding(base64.NoPadding)