Hash and salt passwords in C#

后端 未结 14 1843
野趣味
野趣味 2020-11-22 04:00

I was just going through one of DavidHayden\'s articles on Hashing User Passwords.

Really I can\'t get what he is trying to achieve.

Here is his code:

<
14条回答
  •  死守一世寂寞
    2020-11-22 04:16

    Use the System.Web.Helpers.Crypto NuGet package from Microsoft. It automatically adds salt to the hash.

    You hash a password like this: var hash = Crypto.HashPassword("foo");

    You verify a password like this: var verified = Crypto.VerifyHashedPassword(hash, "foo");

提交回复
热议问题