This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/6] Do not use HP_TIMING_NOW for random bits


Hi Adhemerval,

> 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.

Wilco

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]