blob: 9947f3a246115959fea4040399b6379e99c146e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
//! Implementation of crypto primitives using the Windows CNG (Cryptographic API: Next Generation).
use win_crypto_ng::random::RandomNumberGenerator;
pub mod aead;
pub mod asymmetric;
pub mod ecdh;
pub mod hash;
pub mod symmetric;
/// Fills the given buffer with random data.
pub fn random<B: AsMut<[u8]>>(mut buf: B) {
RandomNumberGenerator::system_preferred()
.gen_random(buf.as_mut())
.expect("system-preferred RNG not to fail")
}
|