Struct SysRng
pub struct SysRng(/* private fields */);Expand description
A compatibility wrapper so we can use ring’s PRG with rand traits.
Implementations§
Trait Implementations§
§impl EntropySource for SysRng
impl EntropySource for SysRng
§fn get_secure_random_bytes(&self) -> [u8; 32]
fn get_secure_random_bytes(&self) -> [u8; 32]
Gets a unique, cryptographically-secure, random 32-byte value. This method must return a
different value each time it is called.
§impl RngCore for SysRng
impl RngCore for SysRng
§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest with random data. Read moreimpl CryptoRng for SysRng
[ring::rand::SystemRandom] is a cryptographically secure PRG
Auto Trait Implementations§
impl Freeze for SysRng
impl RefUnwindSafe for SysRng
impl Send for SysRng
impl Sync for SysRng
impl Unpin for SysRng
impl UnwindSafe for SysRng
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<R> Crng for R
impl<R> Crng for R
§fn gen_secp256k1_ctx(&mut self) -> Secp256k1<All>
fn gen_secp256k1_ctx(&mut self) -> Secp256k1<All>
Helper to get a
secp256k1 context randomized for side-channel
resistance. Suitable for both signing and signature verification.
Use this function instead of calling [Secp256k1::new] directly.§fn gen_secp256k1_ctx_signing(&mut self) -> Secp256k1<SignOnly>
fn gen_secp256k1_ctx_signing(&mut self) -> Secp256k1<SignOnly>
Helper to get a
secp256k1 context randomized for side-channel
resistance. This context can only sign, not verify.
Use this function instead of calling [Secp256k1::new] directly.Source§impl<T> CryptoRngCore for T
impl<T> CryptoRngCore for T
Source§fn as_rngcore(&mut self) -> &mut dyn RngCore
fn as_rngcore(&mut self) -> &mut dyn RngCore
Upcast to an
RngCore trait object.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
Standard: Distribution<T>,
Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> DistIter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn gen_bool(&mut self, p: f64) -> bool
fn gen_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. I.e. gen_ratio(2, 3) has chance of 2 in 3, or about 67%, of
returning true. If numerator == denominator, then the returned value
is guaranteed to be true. If numerator == 0, then the returned
value is guaranteed to be false. Read more§impl<R> RngExt for R
impl<R> RngExt for R
§fn gen_boolean(&mut self) -> bool
fn gen_boolean(&mut self) -> bool
Named gen_boolean to avoid ambiguity with Rng::gen_bool.
fn gen_bytes<const N: usize>(&mut self) -> [u8; N]
§fn gen_alphanum_bytes<const N: usize>(&mut self) -> [u8; N]
fn gen_alphanum_bytes<const N: usize>(&mut self) -> [u8; N]
Generate
N (nearly uniformly random) alphanumeric (0-9, A-Z, a-z)
bytes.