...
Code Block | ||||
---|---|---|---|---|
| ||||
#include<Wincrypt#include <Windows.h> #include <wincrypt.h> #include <stdio.h> HCRYPTPROV hCryptProv; prov; if (CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, 0)) { long int li = 0; if (!CryptGenRandom(hCryptProvprov, sizeof(&li), (BYTE *)&li)) { /* Handle error */ } else { printf("Random number: %ld\n", li); CryptReleaseContext(prov, 0); } |
Risk Assessment
Using the rand()
function leads to possibly predictable random numbers.
...