Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate truly random numbers (NOT pseudo) in Linux

What is the (best) way to create a secure random numbers in Linux (C/ C++ code), more random than the general rand() results, and not pseudo as OpenSSL BN_rand?

In Windows I found CryptGenRandom() as a good option. Is there any equivalent in Linux?

Thank you in advance.

like image 474
rkellerm Avatar asked Nov 29 '22 04:11

rkellerm


1 Answers

you can read from /dev/random which is populated with an entropy pool. There is some good info on the wikipedia site on it: http://en.wikipedia.org/wiki//dev/random

like image 190
Martijn Avatar answered Dec 05 '22 09:12

Martijn