How do I generate an encryption hash in ASP.NET MVC?

后端 未结 4 1051
一个人的身影
一个人的身影 2021-01-05 16:12

I am looking into creating a custom members login system (for learning) and I haven\'t been able to figure out the C# command to generate an encrypted hash.

Is ther

4条回答
  •  走了就别回头了
    2021-01-05 16:32

    I prefer having my hash all in one concatenated string. I borrowed this to build my hash:

    public static string MD5Hash(string itemToHash)
    {
        return string.Join("", MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(itemToHash)).Select(s => s.ToString("x2")));
    }
    

提交回复
热议问题