Expand description

Cryptographic primitives like keypairs and SHA256 hashes.

Generating a Keypair

// OsRng and ChaCha are good defaults for pseudorandom number generation.
use rand::rngs::OsRng;
use rand_chacha::{ChaCha20Rng, rand_core::SeedableRng};
 
let mut osrng = OsRng{};
let mut chacha20_rng = ChaCha20Rng::from_rng(&mut osrng).unwrap();
let keypair = Keypair::generate(&mut chacha20_rng);

Traits

  • Implemented by Keypair and SecretKey to Signer::sign arbitrary bytesequences. Sign the provided message bytestring using Self (e.g. a cryptographic key or connection to an HSM), returning a digital signature.
  • Implemented by Keypair and PublicKey to cryptographically Verifier::verify arbitrary bytesequences. Verify the provided message bytestring using Self (e.g. a public key)

Functions

Type Definitions