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

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

@HarryR

Description

@HarryR

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)
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions