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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e50884573b0f88ebd1f5b495476c13f28a5f0aa2@opteya.com>
Date:   Mon, 17 Oct 2022 20:39:41 +0000
From:   "Yann Droneaud" <ydroneaud@...eya.com>
To:     "Eric Biggers" <ebiggers@...nel.org>,
        "Jason A. Donenfeld" <Jason@...c4.com>
Cc:     linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org,
        sneves@....uc.pt
Subject: Re: [PATCH] random: use rejection sampling for uniform bounded
 random integers

Hi, 

17 octobre 2022 à 20:27 "Eric Biggers" a écrit:
> On Sun, Oct 16, 2022 at 08:37:53PM -0600, Jason A. Donenfeld wrote:
> 
> > 
> > In order to be efficient, we implement a kernel-specific variant of
> >  Daniel Lemire's algorithm from "Fast Random Integer Generation in an
> >  Interval", linked below. The kernel's variant takes advantage of
> >  constant folding to avoid divisions entirely in the vast majority of
> >  cases, works on both 32-bit and 64-bit architectures, and requests a
> >  minimal amount of bytes from the RNG.
> >  
> >  Link: https://arxiv.org/pdf/1805.10941.pdf
> > 
> 

> Thanks for doing this! Your code looks correct, but it was hard for me to
> understand until I read the paper that is linked to. 

Other algorithms exists that might be easier to understand before the Lemire’s one.
M.E. O’Neil has written a long blog post on many possible alternatives.

https://www.pcg-random.org/posts/bounded-rands.html

Regards.

—- 
Yann Droneaud
OPTEYA

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ