Secure Random Number Generator
Provides secure randomness that can be used for the creation of random artifacts — encryption secrets, salts, and nonces — for use with other modules.
#cryptxdevquotes: The new entropy-pooling algorithm for this generator produces about 20% more entropy. In related news, I have 20% less sanity today.
The security of modern encryption depends almost entirely on the ability to generate secure randomness within your cryptosystem. Many random number generators, such as the
rand() function in the toolchain, only appear random but are actually deterministic–a single output maps to a single computable output. This may suffice for your Solitare app’s card stack but not for generating an encryption key. Generators intended for use with cryptography need to operate within additional constraints centered around unpredictability. For details on what this means, as well as to view how this generator holds up, see the Analysis & Overview page.
Returns a securely psuedo-random 32-bit integer.
A securely psuedo-random 32-bit integer.
// returning a single 32-bit random integer uint32_t rand = cryptx_csrand_get();
bool cryptx_csrand_fill(void *buffer, size_t size)
Fills a buffer with securely pseduo-random bytes.
buffer – Pointer to a buffer to fill with random bytes.
size – Size of the buffer to fill.
true on success, false on failure.
buffer filled to size.
// filling a buffer with random bytes #define BUFLEN 16 uint8_t rand[BUFLEN]; cryptx_csrand_fill(rand, BUFLEN);