Securely generate a UNIQUEIDENTIFIER in SQL Server
17
votes
3
answers
8857
views
I intend to be using a
UNIQUEIDENTIFIER
as an access key that users can use to access certain data. The key will act as a password in that sense.
I need to generate multiple such identifiers as part of an INSERT...SELECT
statement. For architectural reasons I want to generate the identifiers server-side in this case.
How can I generate a securely random UNIQUEIDENTIFIER
? Note, that NEWID
would not be random enough as it does not promise any security properties at all. I'm looking for the SQL Server equivalent of System.Security.Cryptography.RandomNumberGenerator because I need unguessable IDs. Anything based on CHECKSUM
, RAND
or GETUTCDATE
would also not qualify.
Asked by usr
(7390 rep)
Apr 4, 2013, 02:09 PM
Last activity: Jul 15, 2022, 03:18 PM
Last activity: Jul 15, 2022, 03:18 PM