chainlink: github.com/smartcontractkit/chainlink/core/services/signatures/secp256k1 Index | Files

package secp256k1

import "github.com/smartcontractkit/chainlink/core/services/signatures/secp256k1"

Package secp256k1 is an implementation of the kyber.{Group,Point,Scalar} //////////////////////////////////////////////////////////////////////////////

XXX: Do not use in production until this code has been audited.

////////////////////////////////////////////////////////////////////////////// interfaces, based on btcd/btcec and kyber/group/mod

XXX: NOT CONSTANT TIME!

Package secp256k1 is an implementation of the kyber.{Group,Point,Scalar} //////////////////////////////////////////////////////////////////////////////

XXX: Do not use in production until this code has been audited.

////////////////////////////////////////////////////////////////////////////// interfaces, based on btcd/btcec and kyber/group/mod

XXX: NOT CONSTANT TIME!

Package secp256k1 is an implementation of the kyber.{Group,Point,Scalar} //////////////////////////////////////////////////////////////////////////////

XXX: Do not use in production until this code has been audited.

////////////////////////////////////////////////////////////////////////////// interfaces, based on btcd/btcec and kyber/group/mod

XXX: NOT CONSTANT TIME!

Package secp256k1 is an implementation of the kyber.{Group,Point,Scalcar} //////////////////////////////////////////////////////////////////////////////

XXX: Do not use in production until this code has been audited.

////////////////////////////////////////////////////////////////////////////// interfaces, based on btcd/btcec and kyber/group/mod

XXX: NOT CONSTANT TIME!

Package secp256k1 is an implementation of the kyber.{Group,Point,Scalar} //////////////////////////////////////////////////////////////////////////////

XXX: Do not use in production until this code has been audited.

////////////////////////////////////////////////////////////////////////////// interfaces, based on btcd/btcec and kyber/group/mod

XXX: NOT CONSTANT TIME!

Index

Package Files

curve.go field.go point.go scalar.go suite.go

Variables

var GroupOrder = secp256k1BTCD.S256().N

func Coordinates Uses

func Coordinates(p kyber.Point) (*big.Int, *big.Int)

Coordinates returns the coordinates of p

func EthereumAddress Uses

func EthereumAddress(p kyber.Point) (rv [20]byte)

EthereumAddress returns the 160-bit address corresponding to p as public key.

func Generate Uses

func Generate(random cipher.Stream) *key.Pair

Generate generates a public/private key pair, which can be verified cheaply on-chain

func IntToScalar Uses

func IntToScalar(i *big.Int) kyber.Scalar

IntToScalar returns i wrapped as a big.Int.

May modify i to reduce mod GroupOrder

func IsSecp256k1Point Uses

func IsSecp256k1Point(p kyber.Point) bool

IsSecp256k1Point returns true if p is a secp256k1Point

func IsSecp256k1Scalar Uses

func IsSecp256k1Scalar(s kyber.Scalar) bool

IsSecp256k1Scalar returns true if p is a secp256k1Scalar

func LongMarshal Uses

func LongMarshal(p kyber.Point) []byte

LongMarshal returns the concatenated coordinates serialized as uint256's

func LongUnmarshal Uses

func LongUnmarshal(m []byte) (kyber.Point, error)

LongUnmarshal returns the secp256k1 point represented by m, as a concatenated pair of uint256's

func RepresentsScalar Uses

func RepresentsScalar(i *big.Int) bool

RepresentsScalar returns true iff i is in the right range to be a scalar

func ScalarToHash Uses

func ScalarToHash(s kyber.Scalar) common.Hash

func ScalarToPublicPoint Uses

func ScalarToPublicPoint(s kyber.Scalar) kyber.Point

ScalarToPublicPoint returns the public secp256k1 point associated to s

func SetCoordinates Uses

func SetCoordinates(x, y *big.Int) kyber.Point

SetCoordinates returns the point (x,y), or panics if an invalid secp256k1Point

func ToInt Uses

func ToInt(s kyber.Scalar) *big.Int

func ValidPublicKey Uses

func ValidPublicKey(p kyber.Point) bool

ValidPublicKey returns true iff p can be used in the optimized on-chain Schnorr-signature verification. See SchnorrSECP256K1.sol for details.

type Secp256k1 Uses

type Secp256k1 struct{}

Secp256k1 represents the secp256k1 group. There are no parameters and no initialization is required because it supports only this one specific curve.

func (*Secp256k1) Point Uses

func (*Secp256k1) Point() kyber.Point

Point returns a new secp256k1 point

func (*Secp256k1) PointLen Uses

func (*Secp256k1) PointLen() int

PointLen returns the length of a marshalled Point

func (*Secp256k1) Scalar Uses

func (*Secp256k1) Scalar() kyber.Scalar

Scalar creates a new Scalar for the prime-order group on the secp256k1 curve

func (*Secp256k1) ScalarLen Uses

func (*Secp256k1) ScalarLen() int

ScalarLen returns the length of a marshalled Scalar

func (*Secp256k1) String Uses

func (*Secp256k1) String() string

String returns the name of the curve

type SuiteSecp256k1 Uses

type SuiteSecp256k1 struct {
    Secp256k1
    // contains filtered or unexported fields
}

SuiteSecp256k1 implements some basic functionalities such as Group, HashFactory, and XOFFactory.

func NewBlakeKeccackSecp256k1 Uses

func NewBlakeKeccackSecp256k1() *SuiteSecp256k1

NewBlakeKeccackSecp256k1 returns a cipher suite based on package go.dedis.ch/kyber/xof/blake2xb, SHA-256, and the secp256k1 curve. It produces cryptographically secure random numbers via package crypto/rand.

func (*SuiteSecp256k1) Hash Uses

func (s *SuiteSecp256k1) Hash() hash.Hash

Hash returns a newly instantiated keccak hash function.

func (*SuiteSecp256k1) New Uses

func (s *SuiteSecp256k1) New(t reflect.Type) interface{}

New implements the kyber.Encoding interface, and returns a new element of type t, which can be a Point or a Scalar

func (*SuiteSecp256k1) RandomStream Uses

func (s *SuiteSecp256k1) RandomStream() cipher.Stream

RandomStream returns a cipher.Stream that returns a key stream from crypto/rand.

func (*SuiteSecp256k1) Read Uses

func (s *SuiteSecp256k1) Read(r io.Reader, objs ...interface{}) error

Read implements the Encoding interface function, and reads a series of objs from r The objs must all be pointers

func (*SuiteSecp256k1) Write Uses

func (s *SuiteSecp256k1) Write(w io.Writer, objs ...interface{}) error

Write implements the Encoding interface, and writes the objs to r using their built-in binary serializations. Supports Points, Scalars, fixed-length data types supported by encoding/binary/Write(), and structs, arrays, and slices containing these types.

func (*SuiteSecp256k1) XOF Uses

func (s *SuiteSecp256k1) XOF(key []byte) kyber.XOF

XOF returns an XOR function, implemented via the Blake2b hash.

This should only be used for generating secrets, so there is no need to make it cheap to compute on-chain.

Package secp256k1 imports 14 packages (graph). Updated 2020-03-24. Refresh now. Tools for package owners.