Does anyone know how to do this in Unity? I’ve been trying for 12 hours…Thanks. I have this message and a “secret key” and I need it turned into SHA512
I really need working example code too
I’ve gathered that it might have something to do with System.Security.Cryptography’s SHA512Managed class, but I don’t understand how to use that class at all it makes no sense to me that is why I need a working example of it turning a string into SHA512
public static string GetSHA512(string text) {
SHA512 sha = new SHA512Managed();
//compute hash from the bytes of text
sha.ComputeHash(ASCIIEncoding.ASCII.GetBytes(text));
//get hash result after compute it
byte[] result = sha.Hash;
StringBuilder strBuilder = new StringBuilder();
for (int i = 0; i < result.Length; i++)
{
//change it into 2 hexadecimal digits
//for each byte
strBuilder.Append(result[i].ToString("x2"));
}
return strBuilder.ToString();
}