Is it possible to create a Javascript version of UUID generator equivalent to Java's

Clash Royale CLAN TAG#URR8PPP
Is it possible to create a Javascript version of UUID generator equivalent to Java's
Is it possible to create a javascript version of UUID generator equivalent to Java's UUID.nameUUIDFromBytes("Hello world".getBytes(Charsets.UTF_8)). Is there anything available for Javascript or Jquery.
UUID.nameUUIDFromBytes("Hello world".getBytes(Charsets.UTF_8))
It should return the exact UUID for an input string for both Java and Javascript versions. Here is the Java version of doing it, https://ideone.com/GYvxCE for reference.
Please help.
thank you, bro. @zero298
– Mahesh Bongani
Aug 1 at 15:23
stackoverflow.com/questions/47505620/…
– Akrion
Aug 1 at 15:35
2 Answers
2
https://www.npmjs.com/package/uuid
Look like this package has methods similar to what you are looking for
Thank you, @balzee. I've tried the package but it is not satisfying my needs. I need a javascript version of the UUID generator which is an exact equivalent to Java UUID for the same input string. Any further help would be greatly appreciable.
– Mahesh Bongani
Aug 1 at 15:05
Thank you guys, for your help. I modified solution provided by @Akrion and it worked for me.
The modified solution is below.
const crypto = require('crypto');
const hexToUuid = require('hex-to-uuid');
const java_kind_hash = (input) =>
var md5Bytes = crypto.createHash('md5').update(input).digest()
md5Bytes[6] &= 0x0f; // clear version
md5Bytes[6]
console.log('java_kind_hash ', java_kind_hash ("HelloWorld"));
// 68e109f0-f40c-372a-95e0-5cc22786f8e6
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Yes, it's possible, but what you're asking is too broad because you are asking for software/library recommendations.
– zero298
Aug 1 at 15:10