lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 25 Mar 2019 01:14:30 GMT From: George Spelvin <lkml@....org> To: Jason@...c4.com, lkml@....org Cc: linux-kernel@...r.kernel.org, tytso@....edu Subject: Re: [RFC PATCH] random: add get_random_max() function P.S. The cited paper calls your algorithm the "OpenBSD algorithm" and has a bunch of benchmarks comparing it to others in Fisher-Yates shuffles of sizes 1e3..1e9. Including all overhead (base PRNG, shuffle), it's 3x slower for 32-bit operations and 8x slower for 64-bit up to arrays of size 1e6, after which cache misses slow all algorithms, reducing the ratio. If you want a faster division-based agorithm, the "Java algorithm" does 1+retries divides: unsigned long java(unsigned long s) { unsigned long x, r; do { x = random_integer(); r = x % s; } while (x - r > -s); return r; }
Powered by blists - more mailing lists