Generating Unique Keys
Paul Rubin
phr-n2003b at NOSPAMnightsong.com
Sat Jan 25 14:46:25 EST 2003
Mongryong <Mongryong at sympatico.ca> writes:
> Right now, I mainly need a way to generate unique (web) session keys.
> However, it would be nice to have a general purpose function for
> generating unique keys.
On Linux, the simplest way is to just read some random bytes from
/dev/urandom and convert them to hex. If you read 16 bytes you
get 32 hex digits and almost no chance of collision.
More information about the Python-list
mailing list