We have a process creating uuid's in TSQL using the following:
SELECT Cast( HASHBYTES('MD5', 'some string') as uniqueidentifier)
I created an API in node js, and they want me to be able to create the same unique identifier off of 'some string'. Is that possible? Using crypto, I can get the same hex value as the HASHBYTES command (crypto.createHash('md5').update('some string').digest("hex")
, but I don't know how I would convert it to the same uuid that TSQL is returning.
I believe what I want is a v3 uuid, but I don't know what the namespace would be. I thought maybe SSMS was using some value specific to the server to create the uuid, but I was able to get the same value on three different servers, two on our network and another on a random EC2 instance.
Am I misunderstanding something very basic about uuid's? Or is there some namespace specific to Microsoft SQL Server, consistent between all servers?
Node libraries I've checked out: uuid, uuid-1345, uuid-lib, guid
via Timbo de Sosa
No comments:
Post a Comment