tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: randomness (crypto?) code example wanted please?



    Date:        Sun, 25 Jun 2017 14:06:02 +0200
    From:        Martin Husemann <martin%duskware.de@localhost>
    Message-ID:  <20170625120602.GB1068%mail.duskware.de@localhost>

  | You can also read random bytes from /dev/urandom.

Yes, I know, and I will do that to get an initial seed if the user
doesn't provide one, but I don't think I can use that to make RANDOM
as it conventionally works - where it generates a pseudo-random
sequence where the user can make it repeat, over and over, identically
(by setting the seed to a constant), for debugging purposes, but is
genuinely (kind of) random otherwise.

What I'd like to accomplish is to get the least predictability possible
given the constraints - even if the numbers repeat every time, it should
be unclear to the user what sequence they will get when they run it the
first time.

And Kamil - I can easily drop the RANDOM_BITS idea - and simply always
return a 15 bit number like everyone else does, that's what my current
version does (because I know how to just test a normal variable and use
its value if set - I do not need to experiment with how to do that, so
I haven't bothered yet...)

I will check to see if there is currently a POSIX bug (change request)
asking for RANDOM to be added, if not, I guess I can make one, it seems
to easily be widely supported enough (though as a new feature, this would
be another change that would not happen before POSIX 8).

kre



Home | Main Index | Thread Index | Old Index