111,097
社区成员




楼主问题解决了吗,我也遇到类似的问题,请教一下
foreach(byte b in hashValue)
{
encodestr += b.ToString("X2");
}
Convert.ToHexString(hashValue)
String encodestr = "";
using (SHA256 mySHA256 = SHA256.Create())
{
// Compute and print the hash values for each file in directory.
try
{
byte[] hashValue = mySHA256.ComputeHash(Encoding.UTF8.GetBytes(str));
foreach(byte b in hashValue)
{
encodestr += b.ToString("X2");
}
Console.WriteLine(encodestr);
}
catch (UnauthorizedAccessException e)
{
Console.WriteLine($"Access Exception: {e.Message}");
}