All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hannes Frederic Sowa" <hannes@stressinduktion.org>
To: "George Spelvin" <lkml@sdf.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>
Cc: netdev@vger.kernel.org
Subject: Re: Revising prandom_32 generator
Date: Tue, 26 Mar 2019 14:03:55 -0400	[thread overview]
Message-ID: <109c67e3-7cda-40cf-80e1-a2d3500a2b5d@www.fastmail.com> (raw)
In-Reply-To: <201903261117.x2QBHTnl002697@sdf.org>

Hi,

On Tue, Mar 26, 2019, at 12:10, George Spelvin wrote:
> I started on a project to correct all of the instances of
> "prandom_u32() % FOO" in the kernel (there are lots)
> to "prandom_u32_max(FOO)".

The conversation definitely makes sense.

Are you trying to fix the modulo biases? I think that prandom_u32_max also has bias, would that be worth fixing as well?

> [...]
>
> Thw ones that seem interesting to me are:
> - Chris Doty-Humphrey's sfc32.  This is a 96-bit chaotic generator
>   (meaning period *probably* long but not well defined) fed with
>   a 32-bit counter to ensure a minimum period.  It's extremely
>   fast, and the author is also the author of PractRand, so it's
>   well-tested.
> - Vigna and Bacman's xoshiro128**.  This is a 128-bit LFSR with some
>   output postprocessing.
> - (on 64-bit machines) xoroshiro128**, by the same authors.
>   This is only efficient on 64-bit machines, so it would need
>   a have a 32-bit backup.
> - Bob Jenkins' jsf (originally "flea").  128 bits, good mixing,
>   fully chaotic.  I prefer the safety of a guaranteed minimum
>   period, but this is well thought of.
> - A lag-3 mutiply-with-carry generator.  2^32 - 1736 is the largest
>   "safe prime" mutiplier.

I think tausworthe is not _trivially_ to predict, what about your proposed algorithms? I think it is a nice to have safety-net in case too much random numbers accidentally leaks (despite reseeding).

Thanks,
Hannes

  reply	other threads:[~2019-03-26 18:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26 11:10 Revising prandom_32 generator George Spelvin
2019-03-26 11:17 ` George Spelvin
2019-03-26 18:03   ` Hannes Frederic Sowa [this message]
2019-03-26 19:07     ` George Spelvin
2019-03-26 19:23       ` Stephen Hemminger
2019-03-27 18:32       ` Hannes Frederic Sowa
2019-03-27 21:43         ` George Spelvin
2019-03-26 14:58 ` Stephen Hemminger
2019-03-26 16:24   ` George Spelvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=109c67e3-7cda-40cf-80e1-a2d3500a2b5d@www.fastmail.com \
    --to=hannes@stressinduktion.org \
    --cc=daniel@iogearbox.net \
    --cc=lkml@sdf.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.