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

package ethschnorr

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

Package ethschnorr implements a version of the Schnorr signature which is //////////////////////////////////////////////////////////////////////////////

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

////////////////////////////////////////////////////////////////////////////// cheap to verify on-chain.

See https://en.wikipedia.org/wiki/Schnorr_signature For vanilla Schnorr.

Since we are targeting ethereum specifically, there is no need to abstract away the group operations, as original kyber Schnorr code does. Thus, these functions only work with secp256k1 objects, even though they are expressed in terms of the abstract kyber Group interfaces.

This code is largely based on EPFL-DEDIS's go.dedis.ch/kyber/sign/schnorr

Index

Package Files

ethschnorr.go

func ChallengeHash Uses

func ChallengeHash(public kyber.Point, rAddress [20]byte, msg *big.Int) (
    kyber.Scalar, error)

ChallengeHash returns the value the signer must use to demonstrate knowledge of the secret key

NB: for parity with the on-chain hash, it's important that public and r marshall to the big-endian x ordinate, followed by a byte which is 0 if the y ordinate is even, 1 if it's odd. See evm/contracts/SchnorrSECP256K1.sol and evm/test/schnorr_test.js

func ValidSignature Uses

func ValidSignature(s Signature) bool

ValidSignature(s) is true iff s.Signature represents an element of secp256k1

func Verify Uses

func Verify(public kyber.Point, msg *big.Int, s Signature) error

Verify verifies the given Schnorr signature. It returns true iff the signature is valid.

type Signature Uses

type Signature = *signature

Signature is a representation of the Schnorr signature generated and verified by this library.

func NewSignature Uses

func NewSignature() Signature

NewSignature allocates space for a Signature, and returns it

func Sign Uses

func Sign(private kyber.Scalar, msg *big.Int) (Signature, error)

Sign creates a signature from a msg and a private key. Verify with the function Verify, or on-chain with SchnorrSECP256K1.sol.

Package ethschnorr imports 5 packages (graph). Updated 2020-03-04. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: