crypto

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: GPL-3.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(curve elliptic.Curve, x, y *big.Int) []byte

Compress ...

func Marshal

func Marshal(curve elliptic.Curve, x, y *big.Int, compress bool) []byte

Marshal ...

func Secp256k1

func Secp256k1() elliptic.Curve

Secp256k1 returns the secp256k1 curve.

func Sha256

func Sha256(data []byte) []byte

Sha256 ...

Types

type CurveParams

type CurveParams struct {
	P       *big.Int // the order of the underlying field
	N       *big.Int // the order of the base point
	B       *big.Int // the constant of the KoblitzCurve equation
	Gx, Gy  *big.Int // (x,y) of the base point
	BitSize int      // the size of the underlying field
	Name    string
}

CurveParams ...

func (*CurveParams) Add

func (curve *CurveParams) Add(x1, y1, x2, y2 *big.Int) (x, y *big.Int)

Add returns the sum of (x1,y1) and (x2,y2)

func (*CurveParams) Double

func (curve *CurveParams) Double(x1, y1 *big.Int) (x, y *big.Int)

Double returns 2*(x,y)

func (*CurveParams) IsOnCurve

func (curve *CurveParams) IsOnCurve(x, y *big.Int) bool

IsOnCurve reports whether the given (x,y) lies on the curve.

func (*CurveParams) Params

func (curve *CurveParams) Params() *elliptic.CurveParams

Params returns the parameters for the curve.

func (*CurveParams) ScalarBaseMult

func (curve *CurveParams) ScalarBaseMult(k []byte) (x, y *big.Int)

ScalarBaseMult returns k*G, where G is the base point of the group and k is an integer in big-endian form.

func (*CurveParams) ScalarMult

func (curve *CurveParams) ScalarMult(Bx, By *big.Int, k []byte) (x, y *big.Int)

ScalarMult returns k*(Bx,By) where k is a number in big-endian form.

type HmacDRBG

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

HmacDRBG ...

func NewHmacDRBG

func NewHmacDRBG(entropy, nonce, pers []byte) *HmacDRBG

NewHmacDRBG ...

func (*HmacDRBG) Generate

func (h *HmacDRBG) Generate(byteLength int32, input []byte) ([]byte, error)

Generate ...

func (*HmacDRBG) Reseed

func (h *HmacDRBG) Reseed(entropy []byte, input []byte) error

Reseed ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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