pub struct SecureRng { /* private fields */ }
Expand description
Cryptographically secure RNG implementation.
Implementations§
Source§impl SecureRng
impl SecureRng
Sourcepub fn init(&mut self) -> Result<(), ThreadError>
pub fn init(&mut self) -> Result<(), ThreadError>
Initialize secure RNG with hardware entropy.
Sourcepub fn fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), ThreadError>
pub fn fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), ThreadError>
Generate cryptographically secure random bytes.
Sourcepub fn next_u64(&mut self) -> Result<u64, ThreadError>
pub fn next_u64(&mut self) -> Result<u64, ThreadError>
Generate random u64.
Sourcepub fn next_u32(&mut self) -> Result<u32, ThreadError>
pub fn next_u32(&mut self) -> Result<u32, ThreadError>
Generate random u32.
Auto Trait Implementations§
impl !Freeze for SecureRng
impl RefUnwindSafe for SecureRng
impl Send for SecureRng
impl Sync for SecureRng
impl Unpin for SecureRng
impl UnwindSafe for SecureRng
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