pub struct Generator { /* private fields */ }
Expand description
A random secp keypair generator
Implementations§
Source§impl Generator
impl Generator
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Generator
Default random number generator is rand::rngs::ThreadRng
Sourcepub fn non_crypto_safe_prng(seed: u64) -> Self
pub fn non_crypto_safe_prng(seed: u64) -> Self
Non crypto safe prng, should only used in tests
Sourcepub fn gen_privkey(&mut self) -> Privkey
pub fn gen_privkey(&mut self) -> Privkey
Generate a Privkey
Sourcepub fn gen_keypair(&mut self) -> (Privkey, Pubkey)
pub fn gen_keypair(&mut self) -> (Privkey, Pubkey)
Generate a keypair
Sourcepub fn random_privkey() -> Privkey
pub fn random_privkey() -> Privkey
Shortcuts construct temporary Generator, and generate a Privkey
Sourcepub fn random_keypair() -> (Privkey, Pubkey)
pub fn random_keypair() -> (Privkey, Pubkey)
Shortcuts construct temporary Generator, and generate a keypair
Sourcepub fn random_secret_key() -> SecretKey
pub fn random_secret_key() -> SecretKey
Shortcuts construct temporary Generator, and generate a SecretKey
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Generator
impl !RefUnwindSafe for Generator
impl !Send for Generator
impl !Sync for Generator
impl Unpin for Generator
impl !UnwindSafe for Generator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more