Home >Database >Mysql Tutorial >How Does SQL Server's PBKDF2 Function Hash Passwords?
SQL Server 2012 introduced the PBKDF2 function, which implements the PBKDF2 algorithm using HMAC-SHA512. The PBKDF2 function takes four parameters:
The PBKDF2 function returns a binary value that contains the hashed password. The following SQL statement shows how to use the PBKDF2 function to hash a password:
DECLARE @password VARBINARY(128) = 0x1234567890ABCDEF; DECLARE @salt VARBINARY(16) = 0xABCDEF0123456789; DECLARE @iterations INT = 10000; DECLARE @outputBytes INT = 64; DECLARE @hashedPassword VARBINARY(64); SELECT @hashedPassword = PBKDF2(@password, @salt, @iterations, @outputBytes); -- The value of @hashedPassword will be a binary value that contains the hashed password.
PBKDF2 is a secure password hashing algorithm that is resistant to brute-force attacks. It is recommended to use PBKDF2 to hash passwords in SQL Server 2012 and later.
The above is the detailed content of How Does SQL Server's PBKDF2 Function Hash Passwords?. For more information, please follow other related articles on the PHP Chinese website!