This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH 4/6] Do not use HP_TIMING_NOW for random bits
> Currently __gen_tempname still requires at least 48 bits to generate the random
> number, so I think returning 64 bits is still preferable. I think we can add
> a comment that the 32 upper bits will show less entropy, what I am not sure is if
> we should add some shuffling to upper bits as well or just document the shuffling
> in lower bits.
It uses just over 35 bits (62^6). Limiting to 32 bits loses 3 bits which don't encode
much entropy to start with (given they only change every 4 seconds). Shifting the
random number before adding the pid would add sufficient extra random bits.
Note for comparison, the generic code has far less entropy, just 20+2 bits from
gettimeofday in every 4 second period. So you'd get collisions when creating
many temporary files in a short time.