crypto

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenECPoints

func FlattenECPoints(in []*ECPoint) ([]*big.Int, error)

func GenerateNTildei

func GenerateNTildei(safePrimes [2]*big.Int) (NTildei, h1i, h2i *big.Int, err error)

Types

type ECPoint

type ECPoint struct {
	// contains filtered or unexported fields
}

ECPoint represents a point on an elliptic curve in affine form. It is designed to be immutable

func DecompressPoint

func DecompressPoint(curve elliptic.Curve, x *big.Int, sign byte) (*ECPoint, error)

func ECBasePoint2

func ECBasePoint2(curve elliptic.Curve) (pt *ECPoint, err error)

ECBasePoint2 returns a shared point of unknown discrete logarithm for the given curve, used only in GG20 ECDSA signing phase 3 (as h) Mimics the KZen-networks/curv impl: https://git.io/JfwSa Not so efficient due to 3x sha256 but it's only used once during a signing round.

func NewECPoint

func NewECPoint(curve elliptic.Curve, X, Y *big.Int) (*ECPoint, error)

Creates a new ECPoint and checks that the given coordinates are on the elliptic curve.

func NewECPointFromProtobuf

func NewECPointFromProtobuf(p *common.ECPoint) (*ECPoint, error)

func NewECPointNoCurveCheck

func NewECPointNoCurveCheck(curve elliptic.Curve, X, Y *big.Int) *ECPoint

Creates a new ECPoint without checking that the coordinates are on the elliptic curve. Only use this function when you are completely sure that the point is already on the curve.

func ScalarBaseMult

func ScalarBaseMult(curve elliptic.Curve, k *big.Int) *ECPoint

func UnFlattenECPoints

func UnFlattenECPoints(curve elliptic.Curve, in []*big.Int, noCurveCheck ...bool) ([]*ECPoint, error)

func (*ECPoint) Add

func (p *ECPoint) Add(b *ECPoint) (*ECPoint, error)

func (*ECPoint) Bytes

func (p *ECPoint) Bytes() []byte

func (*ECPoint) EightInvEight

func (p *ECPoint) EightInvEight() *ECPoint

func (*ECPoint) Equals

func (p *ECPoint) Equals(b *ECPoint) bool

func (*ECPoint) GobDecode

func (p *ECPoint) GobDecode(buf []byte) error

func (*ECPoint) GobEncode

func (p *ECPoint) GobEncode() ([]byte, error)

func (*ECPoint) IsOnCurve

func (p *ECPoint) IsOnCurve() bool

func (*ECPoint) MarshalJSON

func (p *ECPoint) MarshalJSON() ([]byte, error)

crypto.ECPoint is not inherently json marshal-able

func (*ECPoint) Neg

func (p *ECPoint) Neg() *ECPoint

func (*ECPoint) ScalarMult

func (p *ECPoint) ScalarMult(k *big.Int) *ECPoint

func (*ECPoint) ScalarMultBytes

func (p *ECPoint) ScalarMultBytes(k []byte) *ECPoint

func (*ECPoint) SetCurve

func (p *ECPoint) SetCurve(curve elliptic.Curve) *ECPoint

func (*ECPoint) Sub

func (p *ECPoint) Sub(b *ECPoint) (*ECPoint, error)

func (*ECPoint) ToECDSAPubKey

func (p *ECPoint) ToECDSAPubKey() *ecdsa.PublicKey

func (*ECPoint) ToProtobufPoint

func (p *ECPoint) ToProtobufPoint() *common.ECPoint

func (*ECPoint) UnmarshalJSON

func (p *ECPoint) UnmarshalJSON(payload []byte) error

func (*ECPoint) ValidateBasic

func (p *ECPoint) ValidateBasic() bool

func (*ECPoint) X

func (p *ECPoint) X() *big.Int

func (*ECPoint) Y

func (p *ECPoint) Y() *big.Int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL