Hi, All.
I'm playing around with building some data structures backed by a
conventional DHT like Chord or Kademlia.  It seems like many of the elements
in these structures don't need a semantically useful key.  Take a linked
list, for instance.  I need to be able to do a "get" on the head or tail of
the list, but the keys of the interior elements don't need to be exposed to
the caller.  This suggests that I can use random data for these keys.  My
question is, what's the best way to generate these keys.

The obvious approach is just to fill the key (say 128 bits) with random
data.  I think I understand the birthday problem and how to estimate the
probability that a collision will occur.

An alternative approach that was proposed to me was to use 64 bits of random
data and a 64-bit timestamp.  Here, we hope that the random number generator
is not seeded with the system time.  The theory is, the odds of generating 2
identical 64-bit numbers in the same nanosecond is less than the odds of
generating 2 128-bit numbers over the lifetime of the system.  If this is
true, it's not clear to me.

Can anybody suggest a way to quantify the likelyhood of collision in the
second approach?

Thanks,

Russ
_______________________________________________
p2p-hackers mailing list
p2p-hackers@lists.zooko.com
http://lists.zooko.com/mailman/listinfo/p2p-hackers

Reply via email to