Drop last 4 bytes of computed SHA-1 hash

This commit is contained in:
Philippus Baalman 2019-08-23 00:23:46 +02:00 committed by GitHub
parent 39a2838ba0
commit 72a108f960
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -67,7 +67,7 @@ public class UUIDGenerator {
} catch (NoSuchAlgorithmException nsae) {
throw new InternalError("MD5 not supported", nsae);
}
byte[] bytes = md.digest(name);
byte[] bytes = Arrays.copyOfRange(md.digest(name), 0, 16);
bytes[6] &= 0x0f; /* clear version */
bytes[6] |= 0x50; /* set to version 5 */
bytes[8] &= 0x3f; /* clear variant */