> After some minor optimizing, on my laptop here are benchmarks on filling a 1kb byte array: > > Mwc-256-X-X-A-64 (This algorithm): 100.98 ns That comes to 10 GB/s. For comparison, I think ChaCha8 implemented with AVX-512 should run at a similar speed. Maybe a bit faster in short-ish, single-threaded benchmarks. To be clear, there are plenty of caveats in making this comparison: ChaCha8 won't hit that throughput on a…
Designing a New PRNG
31–40 of 52 posts
Re: Designing a New PRNG
#32Earlier quoted context omitted.
There are perfectly legitimate use case (in a tiny niche area) for non-cryptographic RNGs - however, three points: 1. Non-cryptographic RNGs, should they be incorporated in security-critical applications are dangerous . If you insist on manufacturing poisonous chemicals that look appetizing and say “Kool-Aid” on them, kids are going to drink them. And this is your damned fault. 2. Non-cryptographic RNGs should not be…
I agree on all three points. I might even agree on the proposed name; not that I care too much. All I'm saying is that I'm happy the state of art of fast (but insecure) generators is improving and people have better options than cranky old LCGs or Mersenne Twister (ugh!). I don't know why they brought up non-invertibility. But, at a glance, I see a new RNG that might be at least twice as fast as a comparable variant…
1. Insecurity needs to be in the name: Make it Insecure. This is extremely important. Since the intended use-context is going to be non-security critical, anyway, it's actually good that it states it's insecure. That way you know you're not accidentally using RNG where security properties might cause any bottle-necks. At the same time the misuse resistance of the RNG increases significantly.
2. Make sure this is not default, but something that needs to be imported separately from non-security context, such as module about statistics, simulation etc.
Re: Designing a New PRNG
#33Earlier quoted context omitted.
Saving some weight by leaving the airbag out of your car doesn't mean that it going faster is a good thing.
There's no such thing as "a good thing". There are only goals, security is just a goal among other that not everyone have.
See CWE-338 for an enumerated list of these things in the wild.
I found 300+ examples of CVEs with little effort.
Should developers who are writing code that involves cryptography know better? Sure - but they don't. They cut and paste from stackoverflow with horrific results.
Re: Designing a New PRNG
#34> After some minor optimizing, on my laptop here are benchmarks on filling a 1kb byte array: > > Mwc-256-X-X-A-64 (This algorithm): 100.98 ns That comes to 10 GB/s. For comparison, I think ChaCha8 implemented with AVX-512 should run at a similar speed. Maybe a bit faster in short-ish, single-threaded benchmarks. To be clear, there are plenty of caveats in making this comparison: ChaCha8 won't hit that throughput on a…
Chacha generates much bigger outputs (64 byte blocks vs 8 byte) and has somewhat bigger state (512 bits vs 256 or 128 bits). And AVX-512 is Intel-only. To make spinning up the AVX units worth it, you probably need to generate quite a lot of output in larger batches (ie, even bigger state required). It’s still interesting, but less competitive than looking at the GB/s for MB-sized outputs makes it seem.
Re: Designing a New PRNG
#35> After some minor optimizing, on my laptop here are benchmarks on filling a 1kb byte array: > > Mwc-256-X-X-A-64 (This algorithm): 100.98 ns That comes to 10 GB/s. For comparison, I think ChaCha8 implemented with AVX-512 should run at a similar speed. Maybe a bit faster in short-ish, single-threaded benchmarks. To be clear, there are plenty of caveats in making this comparison: ChaCha8 won't hit that throughput on a…
Chacha generates much bigger outputs (64 byte blocks vs 8 byte) and has somewhat bigger state (512 bits vs 256 or 128 bits). And AVX-512 is Intel-only. To make spinning up the AVX units worth it, you probably need to generate quite a lot of output in larger batches (ie, even bigger state required). It’s still interesting, but less competitive than looking at the GB/s for MB-sized outputs makes it seem.
Re: Designing a New PRNG
#36Also, I'd personally argue that 'k-Dimensional Equidistribution' *is* actually fairly useful for a PRNG - certainly I'd argue it's more useful than secure properties in the use cases of simulation or MC...
Re: Designing a New PRNG
#37Earlier quoted context omitted.
Chacha generates much bigger outputs (64 byte blocks vs 8 byte) and has somewhat bigger state (512 bits vs 256 or 128 bits). And AVX-512 is Intel-only. To make spinning up the AVX units worth it, you probably need to generate quite a lot of output in larger batches (ie, even bigger state required). It’s still interesting, but less competitive than looking at the GB/s for MB-sized outputs makes it seem.
If you actually care about performance you should be generating batches of output and pulling entropy out of it, not invoking the PRNG every time you need a random byte. The icache and dcache impact of running all that prng code is going to eat into the performance of your actual software in a way that microbenchmarks won't show. So the need to do that with chacha isn't necessarily a problem, it may be pushing you to…
Re: Designing a New PRNG
#38Earlier quoted context omitted.
Chacha generates much bigger outputs (64 byte blocks vs 8 byte) and has somewhat bigger state (512 bits vs 256 or 128 bits). And AVX-512 is Intel-only. To make spinning up the AVX units worth it, you probably need to generate quite a lot of output in larger batches (ie, even bigger state required). It’s still interesting, but less competitive than looking at the GB/s for MB-sized outputs makes it seem.
If you actually care about performance you should be generating batches of output and pulling entropy out of it, not invoking the PRNG every time you need a random byte. The icache and dcache impact of running all that prng code is going to eat into the performance of your actual software in a way that microbenchmarks won't show. So the need to do that with chacha isn't necessarily a problem, it may be pushing you to…
Re: Designing a New PRNG
#39Earlier quoted context omitted.
Seems that vigna (author of the xoshiro family of rngs) mostly agrees with you > Personally, I don't believe in the "middle ground" of "difficult-to-predict-but-not-crypto": usually it just means it is so easy to break that nobody https://github.com/rust-random/rand/issues/905#issuecomment-...
I wish that issue would also link to the rebuttal: https://www.pcg-random.org/posts/on-vignas-pcg-critique.html
Re: Designing a New PRNG
#40Earlier quoted context omitted.
Seems that vigna (author of the xoshiro family of rngs) mostly agrees with you > Personally, I don't believe in the "middle ground" of "difficult-to-predict-but-not-crypto": usually it just means it is so easy to break that nobody https://github.com/rust-random/rand/issues/905#issuecomment-...
I wish that issue would also link to the rebuttal: https://www.pcg-random.org/posts/on-vignas-pcg-critique.html
PCG's statistical quality is "excellent" but chacha20's just "good"?