View Source Secp256k1.ECDSA (secp256k1 v0.4.1)

Module implementing ECDSA pubkey derivation and signatures

Summary

Functions

Convert uncompressed pubkey to compressed one

Derive compressed pubkey from seckey

Convert compressed pubkey to uncompressed one

Derive pubkey from seckey

Generate ECDSA signature of message hash (AUX is randomly generated)

Generate ECDSA signature of message hash and specify AUX value - NOT RECOMMENDED

Derive uncompressed pubkey from seckey

Check if ECDSA signature is valid

Functions

@spec compress_pubkey(pubkey :: Secp256k1.uncompressed_pubkey()) ::
  Secp256k1.compressed_pubkey()

Convert uncompressed pubkey to compressed one

Link to this function

compressed_pubkey(seckey)

View Source
@spec compressed_pubkey(seckey :: Secp256k1.seckey()) :: Secp256k1.compressed_pubkey()

Derive compressed pubkey from seckey

Link to this function

decompress_pubkey(pubkey)

View Source
@spec decompress_pubkey(pubkey :: Secp256k1.compressed_pubkey()) ::
  Secp256k1.uncompressed_pubkey()

Convert compressed pubkey to uncompressed one

Link to this function

pubkey(seckey, opts \\ [])

View Source

Derive pubkey from seckey

Options

  • :compress (default true) - whether to format pubkey in compressed or uncompressed format
@spec sign(msg_hash :: Secp256k1.hash(), seckey :: Secp256k1.seckey()) ::
  Secp256k1.ecdsa_sig()

Generate ECDSA signature of message hash (AUX is randomly generated)

Link to this function

sign(msg_hash, seckey, aux)

View Source
@spec sign(
  msg_hash :: Secp256k1.hash(),
  seckey :: Secp256k1.seckey(),
  aux :: <<_::256>>
) :: Secp256k1.ecdsa_sig()

Generate ECDSA signature of message hash and specify AUX value - NOT RECOMMENDED

Link to this function

uncompressed_pubkey(seckey)

View Source
@spec uncompressed_pubkey(seckey :: Secp256k1.seckey()) ::
  Secp256k1.uncompressed_pubkey()

Derive uncompressed pubkey from seckey

Link to this function

valid?(signature, msg_hash, pubkey)

View Source
@spec valid?(
  signature :: Secp256k1.ecdsa_sig(),
  msg_hash :: Secp256k1.hash(),
  pubkey :: Secp256k1.compressed_pubkey()
) :: boolean()

Check if ECDSA signature is valid