Diese funktion erzeugt einen hashwert aus einen string
private string HashString(string InputString)
{
StringBuilder ReturnString = new StringBuilder();
SHA512Managed SHA512Mang = new SHA512Managed();
try
{
if (string.IsNullOrEmpty(InputString))
return string.Empty;
byte[] byteData = SHA512Mang.ComputeHash(System.Text.Encoding.ASCII.GetBytes(InputString));
for (int i = 0; i < byteData.Length; i++)
{
ReturnString.Append(byteData[i].ToString("x2"));
}
return ReturnString.ToString();
}
catch (Exception ex)
{
return string.Empty;
}
finally
{
SHA512Mang.Dispose();
}
}
Kommentare zum Snippet