Asp.net MVC - How to hash password

前端 未结 3 632
时光说笑
时光说笑 2020-12-16 06:00

How do I hash an users input(password) to database and then later read the hashed password during login?

I believe the solution is to hash the password upon registe

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 06:49

    Use the System.Web.Helpers.Crypto NuGet package from Microsoft.

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

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

提交回复
热议问题