// This package implements an abstraction for various // elliptic curve primitives, as multiplicative group. package curve import "io" type Data interface { Bytes() []byte String() string } type SomeScalar[S Data] interface { Add(S) S Sub(S) S Mul(S) S Equal(S) bool // Maybe later: // Invert(S) S // Negate(S) S } type ScalarReader[S any] interface { RandomScalar() S ScalarFromReader(io.Reader) (S, error) ScalarFromBytes([]byte) (S, error) ScalarOne() S } type SomeCurve[S SomeScalar[s], s Data, P SomePoint[S, s, p], p Data] interface { ScalarReader[S] Identity() P Generator() P Product(...P) P Exp(S) P } type SomePoint[S SomeScalar[s], s Data, P Data] interface { Mul(P) P Div(P) P Inv() P Exp(S) P Equal(P) bool } /* 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 Generator() P Sum([]P) P Mul(S) P } type APoint[S SomeScalar[s], s Data, P Data] interface { Add(P) P Sub(P) P Neg(P) P ScalarMult(S) P Equal(P) bool } */