pub struct Seed(/* private fields */);
Implementations§
Source§impl Seed
impl Seed
pub const SIZE: usize = 32usize
Sourcepub fn generate<RNG>(rng: &mut RNG) -> Self
pub fn generate<RNG>(rng: &mut RNG) -> Self
Generate a random see with the given Cryptographically secure Random Number Generator (RNG).
This is useful to generate one time only Seed
that does not
need to be remembered or saved.
Sourcepub fn derive_from_key<K, P>(key: K, password: P) -> Self
pub fn derive_from_key<K, P>(key: K, password: P) -> Self
it is possible to derive the Seed from a given key
the key may be given by a secure hardware or simply be a mnemonic phrase given by a user and a password.
It is possible, but not recommended, that the password is left empty. However, the key needs to be large enough to generate enough entropy for the derived seed.
Sourcepub fn into_rand_chacha(self) -> ChaChaRng
pub fn into_rand_chacha(self) -> ChaChaRng
use this to seed a ChaCha RNG
then you can use the RNG to create new private key. This is an handy way to derive a private key from a key and a password (or an HSM and a password?)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Seed
impl RefUnwindSafe for Seed
impl Send for Seed
impl Sync for Seed
impl Unpin for Seed
impl UnwindSafe for Seed
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)