Documentation ¶
Overview ¶
Package twistededwards provides bls24-315's twisted edwards "companion curve" defined on fr.
Index ¶
- type CurveParams
- type PointAffine
- func (p *PointAffine) Add(p1, p2 *PointAffine) *PointAffine
- func (p *PointAffine) Bytes() [sizePointCompressed]byte
- func (p *PointAffine) Double(p1 *PointAffine) *PointAffine
- func (p *PointAffine) Equal(p1 *PointAffine) bool
- func (p *PointAffine) FromExtended(p1 *PointExtended) *PointAffine
- func (p *PointAffine) FromProj(p1 *PointProj) *PointAffine
- func (p *PointAffine) IsOnCurve() bool
- func (p *PointAffine) IsZero() bool
- func (p *PointAffine) Marshal() []byte
- func (p *PointAffine) Neg(p1 *PointAffine) *PointAffine
- func (p *PointAffine) ScalarMultiplication(p1 *PointAffine, scalar *big.Int) *PointAffine
- func (p *PointAffine) Set(p1 *PointAffine) *PointAffine
- func (p *PointAffine) SetBytes(buf []byte) (int, error)
- func (p *PointAffine) Unmarshal(b []byte) error
- type PointExtended
- func (p *PointExtended) Add(p1, p2 *PointExtended) *PointExtended
- func (p *PointExtended) Double(p1 *PointExtended) *PointExtended
- func (p *PointExtended) Equal(p1 *PointExtended) bool
- func (p *PointExtended) FromAffine(p1 *PointAffine) *PointExtended
- func (p *PointExtended) IsZero() bool
- func (p *PointExtended) MixedAdd(p1 *PointExtended, p2 *PointAffine) *PointExtended
- func (p *PointExtended) MixedDouble(p1 *PointExtended) *PointExtended
- func (p *PointExtended) Neg(p1 *PointExtended) *PointExtended
- func (p *PointExtended) ScalarMultiplication(p1 *PointExtended, scalar *big.Int) *PointExtended
- func (p *PointExtended) Set(p1 *PointExtended) *PointExtended
- type PointProj
- func (p *PointProj) Add(p1, p2 *PointProj) *PointProj
- func (p *PointProj) Double(p1 *PointProj) *PointProj
- func (p *PointProj) Equal(p1 *PointProj) bool
- func (p *PointProj) FromAffine(p1 *PointAffine) *PointProj
- func (p *PointProj) IsZero() bool
- func (p *PointProj) MixedAdd(p1 *PointProj, p2 *PointAffine) *PointProj
- func (p *PointProj) Neg(p1 *PointProj) *PointProj
- func (p *PointProj) ScalarMultiplication(p1 *PointProj, scalar *big.Int) *PointProj
- func (p *PointProj) Set(p1 *PointProj) *PointProj
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurveParams ¶
CurveParams curve parameters: ax^2 + y^2 = 1 + d*x^2*y^2
func GetEdwardsCurve ¶
func GetEdwardsCurve() CurveParams
GetEdwardsCurve returns the twisted Edwards curve on bls24-315/Fr
type PointAffine ¶
PointAffine point on a twisted Edwards curve
func NewPointAffine ¶
func NewPointAffine(x, y fr.Element) PointAffine
NewPointAffine creates a new instance of PointAffine
func (*PointAffine) Add ¶
func (p *PointAffine) Add(p1, p2 *PointAffine) *PointAffine
Add adds two points (x,y), (u,v) on a twisted Edwards curve with parameters a, d modifies p
func (*PointAffine) Bytes ¶
func (p *PointAffine) Bytes() [sizePointCompressed]byte
Bytes returns the compressed point as a byte array Follows https://tools.ietf.org/html/rfc8032#section-3.1, as the twisted Edwards implementation is primarily used for eddsa.
func (*PointAffine) Double ¶
func (p *PointAffine) Double(p1 *PointAffine) *PointAffine
Double doubles point (x,y) on a twisted Edwards curve with parameters a, d modifies p
func (*PointAffine) Equal ¶
func (p *PointAffine) Equal(p1 *PointAffine) bool
Equal returns true if p=p1 false otherwise
func (*PointAffine) FromExtended ¶
func (p *PointAffine) FromExtended(p1 *PointExtended) *PointAffine
FromExtended sets p in affine from p in extended coordinates
func (*PointAffine) FromProj ¶
func (p *PointAffine) FromProj(p1 *PointProj) *PointAffine
FromProj sets p in affine from p in projective
func (*PointAffine) IsOnCurve ¶
func (p *PointAffine) IsOnCurve() bool
IsOnCurve checks if a point is on the twisted Edwards curve
func (*PointAffine) IsZero ¶
func (p *PointAffine) IsZero() bool
IsZero returns true if p=0 false otherwise
func (*PointAffine) Marshal ¶
func (p *PointAffine) Marshal() []byte
Marshal converts p to a byte slice
func (*PointAffine) Neg ¶
func (p *PointAffine) Neg(p1 *PointAffine) *PointAffine
Neg sets p to -p1 and returns it
func (*PointAffine) ScalarMultiplication ¶
func (p *PointAffine) ScalarMultiplication(p1 *PointAffine, scalar *big.Int) *PointAffine
ScalarMultiplication scalar multiplication of a point p1 in affine coordinates with a scalar in big.Int
func (*PointAffine) Set ¶
func (p *PointAffine) Set(p1 *PointAffine) *PointAffine
Set sets p to p1 and return it
func (*PointAffine) SetBytes ¶
func (p *PointAffine) SetBytes(buf []byte) (int, error)
SetBytes sets p from buf len(buf) >= sizePointCompressed buf contains the Y coordinate masked with a parity bit to recompute the X coordinate from the curve equation. See Bytes() and https://tools.ietf.org/html/rfc8032#section-3.1 Returns the number of read bytes and an error if the buffer is too short.
func (*PointAffine) Unmarshal ¶
func (p *PointAffine) Unmarshal(b []byte) error
Unmarshal alias to SetBytes()
type PointExtended ¶
PointExtended point in extended coordinates
func (*PointExtended) Add ¶
func (p *PointExtended) Add(p1, p2 *PointExtended) *PointExtended
Add adds points in extended coordinates See https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd
func (*PointExtended) Double ¶
func (p *PointExtended) Double(p1 *PointExtended) *PointExtended
Double adds points in extended coordinates Dedicated doubling https://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-dbl-2008-hwcd
func (*PointExtended) Equal ¶
func (p *PointExtended) Equal(p1 *PointExtended) bool
Equal returns true if p=p1 false otherwise If one point is on the affine chart Z=0 it returns false
func (*PointExtended) FromAffine ¶
func (p *PointExtended) FromAffine(p1 *PointAffine) *PointExtended
FromAffine sets p in projective from p in affine
func (*PointExtended) IsZero ¶
func (p *PointExtended) IsZero() bool
IsZero returns true if p=0 false otherwise
func (*PointExtended) MixedAdd ¶
func (p *PointExtended) MixedAdd(p1 *PointExtended, p2 *PointAffine) *PointExtended
MixedAdd adds a point in extended coordinates to a point in affine coordinates See https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-madd-2008-hwcd-2
func (*PointExtended) MixedDouble ¶
func (p *PointExtended) MixedDouble(p1 *PointExtended) *PointExtended
MixedDouble adds points in extended coordinates Dedicated mixed doubling https://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#doubling-mdbl-2008-hwcd
func (*PointExtended) Neg ¶
func (p *PointExtended) Neg(p1 *PointExtended) *PointExtended
Neg negates point (x,y) on a twisted Edwards curve with parameters a, d modifies p
func (*PointExtended) ScalarMultiplication ¶
func (p *PointExtended) ScalarMultiplication(p1 *PointExtended, scalar *big.Int) *PointExtended
ScalarMultiplication scalar multiplication of a point p1 in extended coordinates with a scalar in big.Int
func (*PointExtended) Set ¶
func (p *PointExtended) Set(p1 *PointExtended) *PointExtended
Set sets p to p1 and return it
type PointProj ¶
PointProj point in projective coordinates
func (*PointProj) Add ¶
Add adds points in projective coordinates cf https://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#addition-add-2008-bbjlp
func (*PointProj) Double ¶
Double adds points in projective coordinates cf https://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#doubling-dbl-2008-bbjlp
func (*PointProj) Equal ¶
Equal returns true if p=p1 false otherwise If one point is on the affine chart Z=0 it returns false
func (*PointProj) FromAffine ¶
func (p *PointProj) FromAffine(p1 *PointAffine) *PointProj
FromAffine sets p in projective from p in affine
func (*PointProj) MixedAdd ¶
func (p *PointProj) MixedAdd(p1 *PointProj, p2 *PointAffine) *PointProj
MixedAdd adds a point in projective to a point in affine coordinates cf https://hyperelliptic.org/EFD/g1p/auto-twisted-projective.html#addition-madd-2008-bbjlp
func (*PointProj) Neg ¶
Neg negates point (x,y) on a twisted Edwards curve with parameters a, d modifies p
func (*PointProj) ScalarMultiplication ¶
ScalarMultiplication scalar multiplication of a point p1 in projective coordinates with a scalar in big.Int