bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-bash] $RANDOM not Cryptographically secure pseudorandom number


From: Chet Ramey
Subject: Re: [bug-bash] $RANDOM not Cryptographically secure pseudorandom number generator
Date: Sun, 20 Jan 2019 17:22:12 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.3.3

On 1/20/19 4:54 PM, Chet Ramey wrote:

>> As an aside, I can confirm the findings of a performance difference
>> between 4.4 and 5.0 when running the script provided earlier in the
>> discussion. At first glance it seems to be due to the switch from the
>> old LCG to the current MINSTD RNG, 
> 
> There's no switch: the bash-4.4 generator and bash-5.0 generators are
> identical. I'll have to do some profiling when I get a chance.

So I ran a quick test.

$ ./bash ./x3
iterations: 1000000
BASH_VERSION: 5.0.2(4)-maint
time: 9.684
$ ../bash-5.0/bash ./x3
iterations: 1000000
BASH_VERSION: 5.0.0(1)-release
time: 9.749
$ ../bash-5.0-patched/bash ./x3
iterations: 1000000
BASH_VERSION: 5.0.2(3)-release
time: 9.840
$ ../bash-4.4-patched/bash ./x3
iterations: 1000000
BASH_VERSION: 4.4.23(7)-release
time: 11.365
$ ../bash-4.4-patched/bash ./x3
iterations: 1000000
BASH_VERSION: 4.4.23(7)-release
time: 11.235
jenna.local(1)

Where the script is Eduardo's iterator that just expands $RANDOM
N times.

The random number generator has been the same since bash-4.0.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]