Search code examples
c++uuidpoco

Shortening unique identifiers


I am generating a UUID in the following way

 UUIDGenerator& generator = UUIDGenerator::defaultGenerator();
 UUID uuid2(generator.createRandom());
 return uuid2.toString() ; //returns f21cf9e1-feb1-4b44-9a24-11400b41d4e8

I want to know if there is a way of shortening this UUID preferably to 8 or fewer character ?


Solution

  • Of course there's a way to shorten it.

    You could simply chop off parts of it. You could hash it with a hash that generates shorter results. Run it through a compression algorithm. And many other simple, silly things.

    Problem is; it wouldn't be a UUID any more.