Skip to main content

TryCryptoRng

Trait TryCryptoRng 

Source
pub trait TryCryptoRng: TryRng { }
Expand description

A marker trait over TryRng for securely unpredictable RNGs

This marker trait indicates that the implementing generator is intended, when correctly seeded and protected from side-channel attacks such as a leaking of state, to be a cryptographically secure generator. This trait is provided as a tool to aid review of cryptographic code, but does not by itself guarantee suitability for cryptographic applications.

Formally, a CSPRNG (Cryptographically Secure Pseudo-Random Number Generator) should satisfy an additional property over other generators: assuming that the generator has been appropriately seeded and has unknown state, then given the first k bits of an algorithm’s output sequence, it should not be possible using polynomial-time algorithms to predict the next bit with probability significantly greater than 50%.

An optional property of CSPRNGs is backtracking resistance: if the CSPRNG’s state is revealed, it will not be computationally-feasible to reconstruct prior output values. This property is not required by CryptoRng.

Implementors of TryCryptoRng should only implement Default if a default-constructed instance is itself a secure generator, for example getrandom::SysRng which is a stateless interface.

Implementors§

Source§

impl TryCryptoRng for ChaCha8Rng

Source§

impl TryCryptoRng for ChaCha12Rng

Source§

impl TryCryptoRng for ChaCha20Rng

Source§

impl TryCryptoRng for StdRng

Available on crate feature std_rng only.
Source§

impl TryCryptoRng for SysRng

Source§

impl TryCryptoRng for ThreadRng

Available on crate feature thread_rng only.
Source§

impl<R> TryCryptoRng for UnwrapErr<R>
where R: TryCryptoRng,

Source§

impl<R> TryCryptoRng for R
where R: DerefMut, <R as Deref>::Target: TryCryptoRng,