directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <>
Subject Re: UUID generator : which one ?
Date Tue, 17 Feb 2009 22:10:43 GMT
Some more insights :

o there are 5 different versions for an UUID :
 - MAC address based (v1)
 - DCE Security based (v2)
 - Name based + MD5 hash ( v3)
 - Random (v4)
 - Name based + SHA1 hash (v5)

As we need a Unique identifier, obviously, V4 can't be a good candidate 
(the collision is still possible, even if not likely). MAC address can 
be discovered in JAVA, but as you only have one MAC address per ethernet 
card, if you want more than one instance of ADS installed on a local 
server, you also may have some collision. So V1 is not a good candidate.
 I don't know how V2 differs from V1.

My guess is that we should use a V3 or V5 UUID, with V5 to be prefered 
over V3.

This shorten the list of possible UUID generator to JDK and Jug.

Stefan Seelmann wrote:
> I'd choose java.util.UUID because it is included in each JDK, no extra
> lib needed.
I agree.

> Maybe we shouldn't use one implementation directly but use a factory
> method. This makes it easier to switch the choosen implementation.
> Example:
>   public String generateUUID(String input);
> or
>   public String generateUUID(byte[] input);
> The input would only be used to generate version 3 or 5 UUIDs.
I like the factory idea. We can do it easily.

Thanks !

cordialement, regards,
Emmanuel L├ęcharny

View raw message