How do you generate a unique identifier. Either for temporary measurers or for tokens used in cookies. There are many reasons we need unique identifiers.

Data::UUID

Data::UUID is a unique identifier creation code implementing the UUID http://en.wikipedia.org/wiki/UUID.

These are guaranteed to be unique - "1 trillion UUIDs would have to be created every nanosecond for 10 billion years to exhaust the number of UUIDs" (source Wikipedia as above).

36 byte strings are produced with simple code:

use Data::UUID;
$ug = new Data::UUID;
for (1..10) {
  print $ug->create_str() . "\n";
}

These are great, but they are guess-able - at least in sequence. This could be a problem for Cookie Tokens used by authentication systems.

OSSP::uuid

On debian systems I install Data::UUID it installs instead OSSP::uuid, which has a Data::UUID stub which provides interface compatibility.

However OSSP::uuid is not on CPAN ! This means it does not go through the same testing process. It makes me a little less happy, but so far I have experienced no issues.

Authentication Tokens

TODO - http://perldesignpatterns.com/?WebAuthentication

Short short version - Hash (e.g. MD5) the key against a secret.