[Cryptography] Use process ID in mixing?

Dave Horsfall dave at horsfall.org
Tue Apr 1 03:01:02 EDT 2014


On Tue, 18 Mar 2014, Sandy Harris wrote:

> On Linux, you can get the caller's pid from kernel code with #include 
> <linux/sched.h> then look at current->pid. Probably there is something 
> similar for other systems and quite possibly there is other usable data 
> in the struct; I haven't looked.

On other systems such as *BSD (and I include the Mac in that), there is 
the getpid() call (get process ID) and getppid() (get parent's process 
ID).  I have no idea why Linux abandoned them.

Just goes to show, if you're cutting important code (such as using the PID
for various reasons) then you'd better be familiar with that platform,
and try to program for other platforms as well.  A common trick to seed
a low-quality PRNG (for non-critical use) is to add the PID to the time;
that way, each process seeding at the same time gets a different one.

I *did* say it was low-quality, for casual use...

-- Dave


More information about the cryptography mailing list