dongmei5168 2013-09-24 12:54
浏览 301
已采纳

.NET sha1.ComputeHash加密十六进制数组在PHP中等效

How can I recreate this .NET hash in PHP?

byte[] bH = Encoding.UTF8.GetBytes(sT);
SHA1 sha1 = SHA1.Create();
byte[] hB = sha1.ComputeHash(bH);
StringBuilder hS = new StringBuilder(hB.Length * 2);
foreach (byte b in hB) {
   hS.AppendFormat("{0:x2}", b);
}
finalValue = hS.ToString();
  • 写回答

1条回答 默认 最新

  • douanye8442 2013-09-24 13:09
    关注

    Answer:

    $finalValue = sha1($sT);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?