我有以下 Visual Basic .NET 函数,用于生成存储在内部数据库中的密码哈希:
Public Function HashPassword(ByVal Password As String, ByVal Salt As String) As String
Dim pwd As String = Password & Salt
Dim hasher As New Security.Cryptography.SHA256Managed()
Dim pwdb As Byte() = System.Text.Encoding.UTF8.GetBytes(pwd)
Dim pwdh As Byte() = hasher.ComputeHash(pwdb)
Return Convert.ToBase64String(pwdh)
End Function
我需要帮助创建与上述函数等效的 PHP:
例子:
Assuming a password string of: warn
A salt value of: i<|Xf":n_y_Yr"Lor`qAA].QK(2C8AJ:Z"\f&TC7bi=Acw_.w|
The returned hash should be: 0Yq3gR09U1GKfFRzmRxdJXK5jSQowHp/YLGA88p0s18=
我无法在 PHP 中复制哈希。
亲切的问候,
声纳器