Expand description
This module contains an implementation of the ECDSA signature scheme over the secp256k1 curve.
Messages can be signed and the signature can be verified again:
§Example
use rand::thread_rng;
let kp = Secp256k1KeyPair::generate(&mut thread_rng());
let message: &[u8] = b"Hello, world!";
let signature = kp.sign(message);
assert!(kp.public().verify(message, &signature).is_ok());Modules§
- recoverable
- This module contains an implementation of the ECDSA signature scheme over the secp256k1 curve.
Structs§
- Secp256k1
KeyPair - Secp256k1 public/private key pair.
- Secp256k1
Private Key - Secp256k1 private key.
- Secp256k1
Public Key - Secp256k1 public key.
- Secp256k1
Signature - Secp256k1 ECDSA signature.
Constants§
- SECP256
K1_ KEYPAIR_ LENGTH - The key pair bytes length is the same as the private key length. This enforces deserialization to always derive the public key from the private key.
- SECP256
K1_ PRIVATE_ KEY_ LENGTH - The length of a private key in bytes.
- SECP256
K1_ PUBLIC_ KEY_ LENGTH - The length of a public key in bytes.
- SECP256
K1_ SIGNATURE_ LENGTH - The length of a signature in bytes.
Statics§
Type Aliases§
- Default
Hash - Default hash function used for signing and verifying messages unless another hash function is
specified using the
with_hashfunctions. - Secp256k1
Public KeyAs Bytes - Secp256k1
Signature AsBytes