The above answer gives the impression that there is no salting applied when using WebSecurity
SimpleMembershipProvider
.
That is not true. Indeed the database salt field is not used, however this does not indicate that there is no salt generated when hashing the password.
In WebSecurity
s SimpleMembershipProvider
the PBKDF2 algo is used, the random salt is generated by the StaticRandomNumberGenerator
and stored in the password field with the hash:
byte[] outputBytes = new byte[1 + SALT_SIZE + PBKDF2_SUBKEY_LENGTH];
Buffer.BlockCopy(salt, 0, outputBytes, 1, SALT_SIZE);
Buffer.BlockCopy(subkey, 0, outputBytes, 1 + SALT_SIZE, PBKDF2_SUBKEY_LENGTH);
return Convert.ToBase64String(outputBytes);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…