I have these methods of encryption to C #, I need this even for PHP, could someone help me convert?
C#
private string GeraSenha(string userPassword)
{
string pwdToHash = userPassword + "^Y8~JJ";
string hash = BCryptHelper.HashPassword(pwdToHash, BCryptHelper.GenerateSalt());
return hash;
}
private bool ChecaSenha(string hashedPwdFromDatabase, string userEnteredPassword)
{
return BCryptHelper.CheckPassword(userEnteredPassword + "^Y8~JJ", hashedPwdFromDatabase);
}
PHP
function CriptSenha($senha) {
$pwdToHash = $senha . "^Y8~JJ"; // ^Y8~JJ is my hard-coded salt
$hash = Bcrypt::hash($senha);
//$hash = BCryptHelper.HashPassword($pwdToHash, BCryptHelper.GenerateSalt());
return $hash;
}
function UncriptSenha($senhadb, $senha) {
if (Bcrypt::check($senha . "^Y8~JJ", $senhadb)) {
return true;
} else {
return false;
}
}
in php the method to check is picking up, but not to encrypt. I need you to help me fix this