tech-crypto 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 13:53:02 +0200
    From:        Kamil Rytarowski <n54%gmx.com@localhost>
    Message-ID:  <93fba221-3f6c-07be-8dc8-efd744c83786%gmx.com@localhost>

  | There is a libc function for this kind of tasks: arc4random_uniform(3).

Sorry, I had missed this message when I replied to Martin's (I did see
your later message).

It looks (from the man page) as if that function fails the "must be able
to generate the same sequence over and over again" requirement of $RANDOM

If there is some way to prevent the ...

	arc4random() seeds itself on a regular basis from
	the kernel strong random number subsystem described in rnd(4).

mechanism, and set an initial seed, and just generate based upon that
rather than a true randomness source, I don't see it.

  | I was evaluation at some point whether this could be done differently,
  | with a dedicated userland random(1) program,

That could be done too.   sh's $RANDOM is not really intended for
anything of crypto strength I don't think.  I suspect half the
implementations just return rand(3) results (ie: garbage).

But $RANDOM is *very* common in other shells, it has been around a
very long time, and I am a little surprised that we do not suffer more
from not having it already.

kre



Home | Main Index | Thread Index | Old Index