pub struct CPRNGEntropy<TPrng>where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,{ /* private fields */ }Expand description
Represents a generic entropy generator, which generates randomness from a cryptographically secure PRNG, but is seed from the actual OS entropy.
Implementations§
Source§impl<TPrng> CPRNGEntropy<TPrng>where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> CPRNGEntropy<TPrng>where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Sourcepub fn new() -> Result<Self, <StdEntropyGenerator as EntropyGenerator>::Error>
pub fn new() -> Result<Self, <StdEntropyGenerator as EntropyGenerator>::Error>
Creates a new instance of CPRNGEntropy
§Errors
These get propagated from [StdEntropyGenerator] when
generating a new seed fails.
Sourcepub fn generate<T: EntropyConcreteGenerator<CPRNGEntropy<TPrng>>>(
&mut self,
) -> T
pub fn generate<T: EntropyConcreteGenerator<CPRNGEntropy<TPrng>>>( &mut self, ) -> T
Generates a new random item.
Trait Implementations§
Source§impl<TPrng> Clone for CPRNGEntropy<TPrng>
impl<TPrng> Clone for CPRNGEntropy<TPrng>
Source§fn clone(&self) -> CPRNGEntropy<TPrng>
fn clone(&self) -> CPRNGEntropy<TPrng>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize, TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for [u8; N]where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<const N: usize, TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for [u8; N]where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for i128where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for i128where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for i16where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for i16where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for i32where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for i32where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for i64where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for i64where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for isizewhere
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for isizewhere
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for u128where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for u128where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for u16where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for u16where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for u32where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for u32where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for u64where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for u64where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for usizewhere
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyConcreteGenerator<CPRNGEntropy<TPrng>> for usizewhere
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§fn generate(
generator: &mut CPRNGEntropy<TPrng>,
) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
fn generate( generator: &mut CPRNGEntropy<TPrng>, ) -> Result<Self, <CPRNGEntropy<TPrng> as EntropyGenerator>::Error>
Generates a new random instance of itself. Read more
Source§impl<TPrng> EntropyGenerator for CPRNGEntropy<TPrng>where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
impl<TPrng> EntropyGenerator for CPRNGEntropy<TPrng>where
TPrng: PRNGenerator + CryptographicallySecure + Seedable<u128>,
Source§type Error = Infallible
type Error = Infallible
CPRNGEntropy cannot fail at randomness generation.
Source§unsafe fn fill_raw(
&mut self,
buffer_ptr: *mut u8,
buffer_len: usize,
) -> Result<(), Infallible>
unsafe fn fill_raw( &mut self, buffer_ptr: *mut u8, buffer_len: usize, ) -> Result<(), Infallible>
Fills raw ptr with randomness based on surrounding entropy. Read more
Auto Trait Implementations§
impl<TPrng> Freeze for CPRNGEntropy<TPrng>where
TPrng: Freeze,
impl<TPrng> RefUnwindSafe for CPRNGEntropy<TPrng>where
TPrng: RefUnwindSafe,
impl<TPrng> Send for CPRNGEntropy<TPrng>where
TPrng: Send,
impl<TPrng> Sync for CPRNGEntropy<TPrng>where
TPrng: Sync,
impl<TPrng> Unpin for CPRNGEntropy<TPrng>where
TPrng: Unpin,
impl<TPrng> UnsafeUnpin for CPRNGEntropy<TPrng>where
TPrng: UnsafeUnpin,
impl<TPrng> UnwindSafe for CPRNGEntropy<TPrng>where
TPrng: UnwindSafe,
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