Im trying to convert the javascript function below to php, but i still get different output the output of the function below is 9e1512ab6b96e83c5021bd06034bce13. Can anyone show me where I’m doing wrong with my code?
function doHash(){
var c = "a228d4d86874eea2717200a15377933b312f46afeb994849ded695130d763391";
var y = "I0E0msM0JY8W9dgL";
var s = CryptoJS.PBKDF2(c, y, {
keySize: 4,
iterations: "200"
});
return s.toString();
}
//output: 9e1512ab6b96e83c5021bd06034bce13
i have try this code in php, but still different output
<?php
function doHash(){
$c = "a228d4d86874eea2717200a15377933b312f46afeb994849ded695130d763391";
$y = 'I0E0msM0JY8W9dgL';
$s = hash_pbkdf2('sha256', $c, $y, 200, 16,true);
return bin2hex($s);
}
echo doHash();
//returns incorrect: f4895ad6fa875a4a25c9fd97875ba13a
?>