The easiest way in Java to turn String into UUID

How to generate a valid UUID from a string? Line one is not what I'm looking for. Rather, I'm looking for something like a hash function that converts any string to a valid UUID.

+6
source share
1 answer

In the Java base library java.util.UUID.nameUUIDFromBytes(byte[]) .

I would not recommend it because it is MD5 based UUID 3, a very broken hash function. You will be better off finding an implementation of UUID 5 that is based on SHA-1 (better, although it also considers inoperative ).

+7
source

Source: https://habr.com/ru/post/974729/


All Articles