ecdsa

package
v0.0.0-...-d2b8996 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashToInt

func HashToInt(c elliptic.Curve, hash []byte) *big.Int

HashToInt -- converts a hash value to an integer. There is some disagreement about how this is done. [NSA] suggests that this is done in the obvious manner, but [SECG] truncates the hash to the bit-length of the curve order first. We follow [SECG] because that's what OpenSSL does. Additionally, OpenSSL right shifts excess bits from the number if the hash is too large and we mirror that too. This is borrowed from crypto/ecdsa.

func NonceRFC6979

func NonceRFC6979(q, x *big.Int, hash []byte) *big.Int

NonceRFC6979 generates an ECDSA nonce (`k`) deterministically according to RFC 6979. https://tools.ietf.org/html/rfc6979#section-3.2 It takes a 32-byte hash as an input and returns 32-byte nonce to be used in ECDSA algorithm.

func Sign

func Sign(priv *ecdsa.PrivateKey, hash []byte) (*big.Int, *big.Int, error)

Sign -- generates a deterministic ECDSA signature according to RFC 6979 and BIP62.

func Verify

func Verify(pub *ecdsa.PublicKey, hash []byte, r *big.Int, s *big.Int) bool

Verify -- calls ecdsa.Verify to verify the signature of hash using the public key. Returns true if the signature is valid, false otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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