On 4/25/19 6:10 PM, Björn Persson wrote:
It's perfectly possible for a number to be unique without being
As an example, you could hash the machine ID, which is supposedly
unique in space, and the system clock, which is unique in time. That
makes the hash unique in both space and time. Produce invocation IDs by
counting up from that value, or by hashing repeatedly. That way you
wouldn't need entropy for invocation IDs at every boot, only during
Such values would of course be somewhat predictable, but according to
what you've said in this thread, invocation IDs don't need to be
unpredictable. You've only said that you want them unique.
That is a good point---and by the way, you COULD make the same argument
for hashing: one could create another installation-time seed value that
will be guaranteed to not leak from the system, and mix it in the hash
creation, making the hash unpredictable.
Between those two workarounds, it looks to me like we don't need
randomness in secular systemd startup at all?
(Of course one needs to be aware that collisions are not impossible,
only improbable. That's equally true for hashes and random numbers.)
At the UUID-level bit lengths, the probability is vanishingly
small---although one does have to realize that even very small
probability events can be realized with enough statistics, like in this
recent measurement of Xenon124 radioactive decay with time constant of
over 10^22 years, trillion times longer than the life of the Universe: