Java – what namespace does the JDK use to generate a UUID named uuidfrombytes?
The sun / Oracle JDK exposes a function used in Java Create a UUID of type 3 (name based) in the util package: Java util. UUID. nameUUIDFromBytes(byte [] name).
I need to be able to generate a UUID of type 3 in Java using nameuuidfrombytes, and when creating a UUID of type 3 in another language, I can get the same UUID. Suppose I provide the same bytes as the source
According to JavaDocs, this function creates a type 3 UUID conforming to RFC 4122 However, according to RFC 4122 specification, a UUID of type 3 must be created in some namespaces Most other languages allow you to specify a namespace when creating type 3 UUIDs (for example, uuidtools gem in Ruby)
So my question is: what namespace UUID does the JDK use when I call nameuuidfrombytes?
Solution
See this bug report
Especially comments, near the bottom:
I don't know if I believe this works, but it should be easy to test using the predefined names in the UUID specification and compare it with the same UUID generated by other implementations