Documentation ¶
Overview ¶
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 ¶
- Variables
- func Coordinates(p kyber.Point) (*big.Int, *big.Int)
- func EthereumAddress(p kyber.Point) (rv [20]byte)
- func Generate(random cipher.Stream) *key.Pair
- func IntToScalar(i *big.Int) kyber.Scalar
- func IsSecp256k1Point(p kyber.Point) bool
- func IsSecp256k1Scalar(s kyber.Scalar) bool
- func LongMarshal(p kyber.Point) []byte
- func LongUnmarshal(m []byte) (kyber.Point, error)
- func RepresentsScalar(i *big.Int) bool
- func ScalarToHash(s kyber.Scalar) common.Hash
- func ScalarToPublicPoint(s kyber.Scalar) kyber.Point
- func SetCoordinates(x, y *big.Int) kyber.Point
- func ToInt(s kyber.Scalar) *big.Int
- func ValidPublicKey(p kyber.Point) bool
- type Secp256k1
- type SuiteSecp256k1
- func (s *SuiteSecp256k1) Hash() hash.Hash
- func (s *SuiteSecp256k1) New(t reflect.Type) interface{}
- func (s *SuiteSecp256k1) RandomStream() cipher.Stream
- func (s *SuiteSecp256k1) Read(r io.Reader, objs ...interface{}) error
- func (s *SuiteSecp256k1) Write(w io.Writer, objs ...interface{}) error
- func (s *SuiteSecp256k1) XOF(key []byte) kyber.XOF
Constants ¶
This section is empty.
Variables ¶
var GroupOrder = secp256k1BTCD.S256().N
Functions ¶
func Coordinates ¶
Coordinates returns the coordinates of p
func EthereumAddress ¶
func EthereumAddress(p kyber.Point) (rv [20]byte)
EthereumAddress returns the 160-bit address corresponding to p as public key.
func Generate ¶
Generate generates a public/private key pair, which can be verified cheaply on-chain
func IntToScalar ¶
IntToScalar returns i wrapped as a big.Int.
May modify i to reduce mod GroupOrder
func IsSecp256k1Point ¶
func IsSecp256k1Point(p kyber.Point) bool
IsSecp256k1Point returns true if p is a secp256k1Point
func IsSecp256k1Scalar ¶
func IsSecp256k1Scalar(s kyber.Scalar) bool
IsSecp256k1Scalar returns true if p is a secp256k1Scalar
func LongMarshal ¶
func LongMarshal(p kyber.Point) []byte
LongMarshal returns the concatenated coordinates serialized as uint256's
func LongUnmarshal ¶ added in v0.8.2
LongUnmarshal returns the secp256k1 point represented by m, as a concatenated pair of uint256's
func RepresentsScalar ¶
RepresentsScalar returns true iff i is in the right range to be a scalar
func ScalarToHash ¶ added in v0.8.2
func ScalarToPublicPoint ¶ added in v0.8.2
func ScalarToPublicPoint(s kyber.Scalar) kyber.Point
ScalarToPublicPoint returns the public secp256k1 point associated to s
func SetCoordinates ¶
SetCoordinates returns the point (x,y), or panics if an invalid secp256k1Point
func ValidPublicKey ¶
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.
Types ¶
type Secp256k1 ¶
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) Scalar ¶
func (*Secp256k1) Scalar() kyber.Scalar
Scalar creates a new Scalar for the prime-order group on the secp256k1 curve
type SuiteSecp256k1 ¶
type SuiteSecp256k1 struct { Secp256k1 // contains filtered or unexported fields }
SuiteSecp256k1 implements some basic functionalities such as Group, HashFactory, and XOFFactory.
func NewBlakeKeccackSecp256k1 ¶
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 ¶
func (s *SuiteSecp256k1) Hash() hash.Hash
Hash returns a newly instantiated keccak hash function.
func (*SuiteSecp256k1) New ¶
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 ¶
func (s *SuiteSecp256k1) RandomStream() cipher.Stream
RandomStream returns a cipher.Stream that returns a key stream from crypto/rand.
func (*SuiteSecp256k1) Read ¶
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 ¶
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 ¶
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.