SQL Server - What's a good way to generate a random 512 bit salt in SQL
Server 2012?
What is a good way to generate a random 512 bit salt in SQL Server 2012?
I'm using the below:
declare @salt varbinary(512)
set @salt = HASHBYTES('SHA2_512', cast(rand() as nvarchar(12)))
Edit -> I don't like the length of the string passed into the Hashbytes
function. It seems like I'll get a repeating value fairly easily. I could
use something like the below to increase this string length:
cast(rand() as nvarchar(12)) + cast(rand() as nvarchar(12))
Just looking to see if this is acceptable from a security standpoint or if
there is a more accepted approach to this problem.
No comments:
Post a Comment