Documentation ¶
Index ¶
- Variables
- type ECPoint
- func ComputeLinearCombinationPoint(scalar []*big.Int, points []*ECPoint) (*ECPoint, error)
- func NewBase(curve elliptic.Curve) *ECPoint
- func NewECPoint(curve elliptic.Curve, x *big.Int, y *big.Int) (*ECPoint, error)
- func NewIdentity(curve elliptic.Curve) *ECPoint
- func ScalarBaseMult(c elliptic.Curve, k *big.Int) *ECPoint
- func (p *ECPoint) Add(p1 *ECPoint) (*ECPoint, error)
- func (p *ECPoint) Copy() *ECPoint
- func (p *ECPoint) Equal(p1 *ECPoint) bool
- func (p *ECPoint) GetCurve() elliptic.Curve
- func (p *ECPoint) GetX() *big.Int
- func (p *ECPoint) GetY() *big.Int
- func (p *ECPoint) IsEvenY() bool
- func (p *ECPoint) IsIdentity() bool
- func (p *ECPoint) IsSameCurve(p2 *ECPoint) bool
- func (p *ECPoint) Neg() *ECPoint
- func (p *ECPoint) ScalarMult(k *big.Int) *ECPoint
- func (p *ECPoint) String() string
- func (p *ECPoint) ToEcPointMessage() (*EcPointMessage, error)
- func (p *ECPoint) ToPubKey() *ecdsa.PublicKey
- type EcPointMessage
- func (*EcPointMessage) Descriptor() ([]byte, []int)deprecated
- func (x *EcPointMessage) GetCurve() EcPointMessage_Curve
- func (x *EcPointMessage) GetX() []byte
- func (x *EcPointMessage) GetY() []byte
- func (*EcPointMessage) ProtoMessage()
- func (x *EcPointMessage) ProtoReflect() protoreflect.Message
- func (x *EcPointMessage) Reset()
- func (x *EcPointMessage) String() string
- func (p *EcPointMessage) ToPoint() (*ECPoint, error)
- type EcPointMessage_Curve
- func (EcPointMessage_Curve) Descriptor() protoreflect.EnumDescriptor
- func (x EcPointMessage_Curve) Enum() *EcPointMessage_Curve
- func (EcPointMessage_Curve) EnumDescriptor() ([]byte, []int)deprecated
- func (c EcPointMessage_Curve) GetEllipticCurve() (elliptic.Curve, error)
- func (x EcPointMessage_Curve) Number() protoreflect.EnumNumber
- func (x EcPointMessage_Curve) String() string
- func (EcPointMessage_Curve) Type() protoreflect.EnumType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDifferentLength is returned if the two slices has different lengths. ErrDifferentLength = errors.New("different lengths of slices") // ErrEmptySlice is returned if the length of slice is zero. ErrEmptySlice = errors.New("the length of slice is zero") )
var ( // ErrInvalidPoint is returned if the point is invalid. ErrInvalidPoint = errors.New("invalid point") // ErrDifferentCurve is returned if the two different elliptic curves. ErrDifferentCurve = errors.New("different elliptic curves") // ErrInvalidCurve is returned if the curve is invalid. ErrInvalidCurve = errors.New("invalid curve") )
var ( EcPointMessage_Curve_name = map[int32]string{ 0: "P224", 1: "P256", 2: "P384", 3: "S256", 4: "EDWARD25519", } EcPointMessage_Curve_value = map[string]int32{ "P224": 0, "P256": 1, "P384": 2, "S256": 3, "EDWARD25519": 4, } )
Enum value maps for EcPointMessage_Curve.
var File_github_com_getamis_alice_crypto_ecpointgrouplaw_point_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type ECPoint ¶
type ECPoint struct {
// contains filtered or unexported fields
}
ECPoint is the struct for an elliptic curve point.
func ComputeLinearCombinationPoint ¶
ComputeLinearCombinationPoint returns the linear combination of points by multiplying scalar. Give two arrays: [a1,a2,a3] and points in secp256k1 [G1,G2,G3]. The outcome of this function is a1*G1+a2*G2+a3*G3. Ex: Give two arrays: [1,2,5] and points in secp256k1 [G1,G2,G3]. The outcome of this function is 1*G1+2*G2+5*G3.
func NewECPoint ¶
NewECPoint creates an EC-Point and verifies that it should locate on the given elliptic curve. Note: when x = nil, y =nil, we set it to be the identity element in the elliptic curve group.
func NewIdentity ¶
NewIdentity returns the identity element of the given elliptic curve.
func ScalarBaseMult ¶
ScalarBaseMult multiplies the base point k times.
func (*ECPoint) IsIdentity ¶
IsIdentity checks if the point is the identity element.
func (*ECPoint) IsSameCurve ¶
IsSameCurve checks if the point is on the same curve with the given point.
func (*ECPoint) ScalarMult ¶
ScalarMult multiplies the point k times. If the point is the identity element, do nothing.
func (*ECPoint) ToEcPointMessage ¶
func (p *ECPoint) ToEcPointMessage() (*EcPointMessage, error)
ToEcPointMessage converts the point to proto message.
type EcPointMessage ¶
type EcPointMessage struct { Curve EcPointMessage_Curve `` /* 127-byte string literal not displayed */ X []byte `protobuf:"bytes,2,opt,name=x,proto3" json:"x,omitempty"` Y []byte `protobuf:"bytes,3,opt,name=y,proto3" json:"y,omitempty"` // contains filtered or unexported fields }
func (*EcPointMessage) Descriptor
deprecated
func (*EcPointMessage) Descriptor() ([]byte, []int)
Deprecated: Use EcPointMessage.ProtoReflect.Descriptor instead.
func (*EcPointMessage) GetCurve ¶
func (x *EcPointMessage) GetCurve() EcPointMessage_Curve
func (*EcPointMessage) GetX ¶
func (x *EcPointMessage) GetX() []byte
func (*EcPointMessage) GetY ¶
func (x *EcPointMessage) GetY() []byte
func (*EcPointMessage) ProtoMessage ¶
func (*EcPointMessage) ProtoMessage()
func (*EcPointMessage) ProtoReflect ¶ added in v1.0.2
func (x *EcPointMessage) ProtoReflect() protoreflect.Message
func (*EcPointMessage) Reset ¶
func (x *EcPointMessage) Reset()
func (*EcPointMessage) String ¶
func (x *EcPointMessage) String() string
func (*EcPointMessage) ToPoint ¶
func (p *EcPointMessage) ToPoint() (*ECPoint, error)
ToPoint converts the point from proto message.
type EcPointMessage_Curve ¶
type EcPointMessage_Curve int32
const ( EcPointMessage_P224 EcPointMessage_Curve = 0 EcPointMessage_P256 EcPointMessage_Curve = 1 EcPointMessage_P384 EcPointMessage_Curve = 2 // Above curves are not implemented EcPointMessage_S256 EcPointMessage_Curve = 3 EcPointMessage_EDWARD25519 EcPointMessage_Curve = 4 )
func (EcPointMessage_Curve) Descriptor ¶ added in v1.0.2
func (EcPointMessage_Curve) Descriptor() protoreflect.EnumDescriptor
func (EcPointMessage_Curve) Enum ¶ added in v1.0.2
func (x EcPointMessage_Curve) Enum() *EcPointMessage_Curve
func (EcPointMessage_Curve) EnumDescriptor
deprecated
func (EcPointMessage_Curve) EnumDescriptor() ([]byte, []int)
Deprecated: Use EcPointMessage_Curve.Descriptor instead.
func (EcPointMessage_Curve) GetEllipticCurve ¶
func (c EcPointMessage_Curve) GetEllipticCurve() (elliptic.Curve, error)
func (EcPointMessage_Curve) Number ¶ added in v1.0.2
func (x EcPointMessage_Curve) Number() protoreflect.EnumNumber
func (EcPointMessage_Curve) String ¶
func (x EcPointMessage_Curve) String() string
func (EcPointMessage_Curve) Type ¶ added in v1.0.2
func (EcPointMessage_Curve) Type() protoreflect.EnumType