【发布时间】:2023-03-05 07:41:01
【问题描述】:
我尝试将以下 C# 方法重写为 SQL Server 2014 代码。至今无果。
public static string GetHash(string input)
{
HashAlgorithm hashAlgorithm = new SHA256CryptoServiceProvider();
byte[] byteValue = System.Text.Encoding.UTF8.GetBytes(input);
byte[] byteHash = hashAlgorithm.ComputeHash(byteValue);
return Convert.ToBase64String(byteHash);
}
尤其是 UTF8 的编码给我带来了麻烦。
感谢您的帮助。
【问题讨论】:
-
是的 - 编码为 UTF-8 会给您带来麻烦,因为 SQL Server 不支持 UTF-8 ...
标签: c# sql-server migration string-hashing