Expand description
§rdseed
Rust interface to RDSEED / RDRAND CPU instructions.
§About
Get 64, 32, 16 bit RDSEED or RDRAND from the hardware, fill a byte slice.
RDSEED numbers are trully random, while RDRAND numbers are from cryptographic strong pseudo random number generator.
§Usage
Functions are nonblocking returning an Option type.
Operation can fail if hardware do not supports instruction or if no randomness is available at this moment.
Functions from module rand are using strong pseudo random number generator and will less likely to fail due to no randomness available at this moment.
To query if hardware supports operation use is_available function.
To block until randomness is available use blocking wrapper function.
For filling a byte slice use blocking function fill_bytes.
§Portability
x64 CPU with RDSEED / RDRAND instructions.
§License
This is free and unencumbered software released into the public domain.
This code can be used under terms of CC0 or the Unlicense.
![]()
Modules§
- rand
- Interface to RDRAND, strong pseudo random number generator.
Functions§
- blocking
- Block until randomness is available.
- fill_
bytes - Fills u8 buffer with random bytes generated by the provided function.
- get16
- Attempts to get a 16-bit seed from the hardware.
- get32
- Attempts to get a 32-bit seed from the hardware.
- get64
- Attempts to get a 64-bit seed from the hardware.
- is_
available - Checks if hardware supports RDSEED instruction.