Password encryption in C#?

前端 未结 2 1073
心在旅途
心在旅途 2021-01-03 12:54

How can I encrypt and decrypt passwords in C#? Thanks for any help.

2条回答
  •  醉话见心
    2021-01-03 13:28

    UPDATED

    See this answer: C# Password Encryption

    -- or --

    Read this post: http://csharptest.net/470/another-example-of-how-to-store-a-salted-password-hash/


    There is lots of good and bad information on the internet about storing passwords. You need to know two things:

    1. You should use a 'salted' hash to prevent dictionary attacks
    2. You use at minimal the SHA256 hash provider

    A quick search gave me this sample code: http://www.obviex.com/samples/hash.aspx

    and I'd go with this SaltedHash utility class (looks fairly complete at a glance):

    http://www.dijksterhuis.org/creating-salted-hash-values-in-c/

提交回复
热议问题