Reputation: 514
I have this function in .net
public static byte[] EncryptPassword(string username, string pwd, string salt)
{
string toHash = username + salt + pwd;
UTF8Encoding textConverter = new UTF8Encoding();
byte[] passBytes = textConverter.GetBytes(toHash);
byte[] thePassword = new SHA384Managed().ComputeHash(passBytes);
return thePassword;
}
and trying to convert it into php
function EncryptPassword($username, $pwd, $salt)
{
$hash = $username.$salt.$pwd;
return hash('sha384',$hash);
}
but I m unable to get the same password hash,any help ?
Upvotes: 1
Views: 102
Reputation: 1945
Well you're using $password
inside the function, but passing $pwd
as an argument.
Upvotes: 3