hello,

this is my first post here, so please sorry if the question feels clumsy or 
inappropriate.

i am concerned about the use of random generation so i thought using openssl 
random generation algorithm would be agood idea. Indeed after browsing at the 
openssl rand source it seems the seeding part feels rather serious compared to 
other implementations i have seen.

However, i am experiencing a funny situation

I tried to generate 100 bytes using 
openssl rand 100
But i observed on my Windows machine (openssl from cygwin) that sometimes the 
result is not always 100 bytes long, I experienced 101, 102...
However, while using -hex switch, the variable size issue does not seem to 
reproduce.
Observation does not reproduce at all on Ubuntu 12.04 btw (see version info 
below)

Do you guys reproduce the behavior ? Am i missing something obvious ? is it 
related to my environment ? is it an openssl bug (i have not seen anything like 
this on http://rt.openssl.org/index.html?q=rand)


thanks
alexis


Alexis@LORCAP0006 ~
$ uname -a
CYGWIN_NT-5.1 LORCAP0006 1.7.15(0.260/5/3) 2012-05-09 10:25 i686 Cygwin

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
102

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
101

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
101

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
101

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
101

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
100

Alexis@LORCAP0006 ~
$ openssl rand 100 | wc -c
101

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@LORCAP0006 ~
$ openssl rand 100 -hex | wc -c
202

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 | wc -c
100372

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 | wc -c
100378

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 | wc -c
100373

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 | wc -c
100385

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 | wc -c
100354

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 | wc -c
100403

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 | wc -c
100409

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 -hex | wc -c
200002

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 -hex | wc -c
200002

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 -hex | wc -c
200002

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$ openssl rand 100000 -hex | wc -c
200002

Alexis@CORLAP0006 /usr/src/openssl-1.0.1c
$





ubuntu@ubuntu-VirtualBox:~$ uname -a
Linux ubuntu-VirtualBox 3.2.0-24-generic-pae #37-Ubuntu SMP Wed Apr 25 10:47:59 
UTC 2012 i686 athlon i386 GNU/Linux
ubuntu@ubuntu-VirtualBox:~$ openssl version
OpenSSL 1.0.1 14 Mar 2012
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120
ubuntu@ubuntu-VirtualBox:~$ openssl rand 120 | wc -c
120

                                          
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to