aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/beam_lib.erl
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2018-09-18 16:33:47 +0200
committerGitHub <[email protected]>2018-09-18 16:33:47 +0200
commitb2c338cb8d84567204765db87c7299519f1e1ad6 (patch)
tree91c6c4225c639e50b68619c19f14146523c65e0d /lib/stdlib/src/beam_lib.erl
parent146bcbf1f4f9cefb73223a654ca5e992ebe43aa8 (diff)
parent0f79e3f3d95fd8f04e3893e50c9f27b9e04c2c7e (diff)
downloadotp-b2c338cb8d84567204765db87c7299519f1e1ad6.tar.gz
otp-b2c338cb8d84567204765db87c7299519f1e1ad6.tar.bz2
otp-b2c338cb8d84567204765db87c7299519f1e1ad6.zip
Merge pull request #1857 from RaimoNiskanen/raimo/rand-crypto-xoroshiro928
OTP-14461 - New 'rand' algorithm: Xoroshiro928** also for 'crypto' Implement a new 'rand' algorithm named 'exro928ss' and a new 'crypto' plugin for 'rand' named 'crypto_aes'. Both are based on Xoroshiro928** which is derived from Xoroshiro1024** modified to use 58-bit words for performance reasons in the Erlang VM. Xoroshiro1024** has got the Xoroshiro1024 generator and the StarStar scrambler from the 2018 paper "Scrambled Linear Pseudorandom Number Generators" by David Blackman and Sebastiano Vigna. This generator and scrambler combination shows no systematic weaknesses in standard statistical tests as TestU01(BigCrush) and PractRand, unlike the previously used * and + scramblers in the 'rand' module that exhibit statistical weaknesses for the lowest bits. The 'crypto' plugin uses AES-256 as scrambler and the Xoroshiro928 as generator, which gives the same very long period and jump functions as for Xoroshiro928**, but a cryptographically secure scrambler gives absolutely no detectable statistical weaknesses regardless of how the generated numbers are used. The speed of 'exro928ss' is only about 30-50% slower than the default fast 'rand' algorithm, but the state is roughly the double and it produces about 8 times the garbage per iteration. The speed of 'crypto_aes' is about half (amortized) that of the default fast 'rand' algorithm which is fast and thanks to doing encryption in batches caching the result. Hence the state is much larger.
Diffstat (limited to 'lib/stdlib/src/beam_lib.erl')
0 files changed, 0 insertions, 0 deletions