I want to hash a String with C# in Xamarin. Normally i use:
using System.Security.Cryptography;
public string SHA512StringHash(String input)
{
SHA512 shaM = new SHA512Managed();
// Convert the input string to a byte array and compute the hash.
byte[] data = shaM.ComputeHash(Encoding.UTF8.GetBytes(input));
// Create a new Stringbuilder to collect the bytes
// and create a string.
StringBuilder sBuilder = new StringBuilder();
// Loop through each byte of the hashed data
// and format each one as a hexadecimal string.
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
// Return the hexadecimal string.
input = sBuilder.ToString();
return (input);
}
But in Xamarin i seem not able to include this library. Now i was wondering, if there is a way to include this library or an alternitive to easily hash a Password.