[英]PHP MD5 hashing
簡而言之,我在C#中有一個哈希算法,它是:
string hashCode = string.Empty;
if (null != password)
{
System.Security.Cryptography.MD5 cryptography = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] code = cryptography.ComputeHash(Encoding.Default.GetBytes(password));
StringBuilder stringBuilder = new StringBuilder();
// Converting the code to string.
for (int i = 0; i < code.Length; i++)
{
stringBuilder.Append(code[i].ToString("x2"));
}
hashCode = stringBuilder.ToString();
}
return hashCode;
}
現在,我需要在php中復制此行為。
注意:我無法更改C#行為,因為它已經實現,並且使用此算法將密碼保存在數據庫中。
見下文
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.