How can I SHA512 a string in C#?

后端 未结 10 1305
伪装坚强ぢ
伪装坚强ぢ 2020-12-08 18:35

I am trying to write a function to take a string and sha512 it like so?

public string SHA512(string input)
{
     string hash;

     ~magic~

     return has         


        
10条回答
  •  隐瞒了意图╮
    2020-12-08 19:06

    You could use the System.Security.Cryptography.SHA512 class

    MSDN on SHA512

    Here is an example, straigt from the MSDN

    byte[] data = new byte[DATA_SIZE];
    byte[] result;
    SHA512 shaM = new SHA512Managed();
    result = shaM.ComputeHash(data);
    

提交回复
热议问题