C# ハッシュ アルゴリズムをノードと一致させるのに問題があります。問題は Unicode エンコーディングにあるようです。文字列を Unicode に変換してハッシュし、16 進数として出力する方法はありますか? 残念ながら、C# コードを変更することはできません。それは私の手に負えません。
ノードアルゴリズム
function createMd5(message) {
var crypto = require("crypto");
var md5 = crypto.createHash("md5");
return md5.update(message).digest('hex');
}
c# ハッシュ アルゴリズム
private static string GetMD5(string text)
{
UnicodeEncoding UE = new UnicodeEncoding();
byte[] hashValue;
byte[] message = UE.GetBytes(text);
using (MD5 hasher = new MD5CryptoServiceProvider())
{
string hex = "";
hashValue = hasher.ComputeHash(message);
foreach (byte x in hashValue)
{
hex += String.Format("{0:x2}", x);
}
return hex.ToLower();
}
}