dcrypt.random.rdrand

Members

Structs

RDRand
struct RDRand

Examples

The RDRand PRNG generates random data with intels rdrand instruction. Use RDRand.isSupported to check at runntime if rdrand is supported.

TODO: This module is not yet tested.

1 t {
2 	if(RDRand.isSupported) {
3 		ubyte[71] buf1;
4 		ubyte[71] buf2;
5 
6 		RDRand rand;
7 
8 		rand.nextBytes(buf1);
9 		rand.nextBytes(buf2);
10 		
11 		assert(buf1 != buf2, "rdrand produced twice the same output!");
12 
13 		ubyte[32] buf3; // Test multiple of 8.
14 		rand.nextBytes(buf3);

Meta