[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Entropy in the implementation of Lua
- From: Roger Leigh <rleigh@...>
- Date: Thu, 16 Mar 2023 20:24:58 +0000
> -----Original Message-----
> From: Gerhard Sittig <firstname.lastname@example.org>
> Sent: Thursday, March 16, 2023 2:32 PM
> To: Lua mailing list <email@example.com>
> Subject: Re: Entropy in the implementation of Lua
> On Thu, 2023-03-16 at 06:40 +0100, bil til wrote:
> > Am Mi., 15. März 2023 um 20:28 Uhr schrieb Roger Leigh
> > >
> > > [ ... replace this with a direct call to a hardware RNG and get a
> > > truly random number straight from the hardware. ...]
> > ... this I tried also, but it is not so easy, as the RNG module is
> > analogue and thus "a bit slow". It needs startup-time in millisecond
> > range, and also the random values are not created "super-high-speed"
> > (at least not in "digital clock speed" of the controller - I felt a
> > bit unsure what would happen if Lua would ask for many random values
> > one after each other - I would not like to invoke "delay waiting
> > states" then (but I did NOT investigate this further so far)).
> But isn't the point that you don't keep draining random numbers from the
> external hardware that is slow to generate them (the reason being that you
> get something really random, which is what you want in that specific case)?
> That's why you have a pseudo RNG in the software, and _seed_ that from
> something with much better entropy. Results in the fast(er) generation of
> GoodEnough(TM) random numbers at an acceptable cost. Or did I miss
Yes, my initial implantation is being very naïve and slow here, and I would definitely be better off using it as a random seed. I've yet to profile it properly to see how frequently it is called in practice, and I might be in for a nasty surprise!