如何能繞過SQL Server 2012中創建散列碼的8000個字符的限制,MD5的hashCode C#.NET
select SUBSTRING(sys.fn_sqlvarbasetostr(HASHBYTES('MD5', 'Sample
string with more than 8000 Characters')),3,32) as MD5HashCode
我嘗試用C#語法工作。
String str = "Sample string with more than 8000 Characters"
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.Unicode.GetBytes(str);
bs = x.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
s.Append(b.ToString("x2").ToLower());
}
但是,計算出的HashCode SQL查詢在C#語法中是不同的。
在此先感謝。
的可能的複製[TSQL MD5哈希到C#的.NET MD5不同](http://stackoverflow.com/questions/27908449/tsql -md5公頃sh-different-to-c-sharp-net-md5) – Mark