How To Generate Random Numbers In Linux


Generating random numbers can be seem odd. But it is very important for security. In security field whatever best chiper or algorithm you use if you can’t generate random numbers it is useless from point of view of security. So how can we generate random numbers in linux environment.

Generate With Urandom

First choise is to used /dev/urandom or /dev/random by using dd if=/dev/urandom of=/home/ismail/myrandom . But this random file will be binary.

Generate With Openssl

Second option is to use openssl which is core security library for a lot of application. openssl rand 256 command will generate 256 byte of random data with binary format. to generate more readable format like hex use -hex option openssl rand -hex 256

Generate With Python

Third option is using python random library. But this library generates random numbers rather than random data.

LEARN MORE  How Convert Files Between Ascii and Utf-8

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)