Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Split CurvePoint into Curve & CurvePoint, with P256k1 and BN256 implementations #21

Open
HarryR opened this issue Nov 24, 2017 · 0 comments

Comments

@HarryR
Copy link
Contributor

HarryR commented Nov 24, 2017

This abstraction will add clarity make it possible to use the same code with multiple curves.

The two interfaces will look something like:

type Curve interface {
        PointFromXYBase10(string,string) *CurvePoint
	PointFromXY(*big.Int,*big.Int) *CurvePoint
	PointFromHash() *CurvePoint
	Prime() *big.Int
	Order() *big.Int
	RandomN() *big.Int
	RandomP() *big.Int
        ScalarBaseMult(*big.Int) *CurvePoint
}

type CurvePoint interface {
        Equals() ?
        GetXY() (*big.Int,*big.Int)
        SetFromXY(*big.Int, *big.Int)
        IsOnCurve() bool
        ScalarMult(*big.Int)
        Add(*CurvePoint)
        ParameterPointAdd(*big.Int,*big.Int)
        HashPointAdd(*CurvePoint, *big.Int, *big.Int)
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants