I have this function on javascript
function b(e, t) {
return e << t | e >>> 32 - t
}
function c(e, t) {
var n, r, a, o, i;
return a = 2147483648 & e, o = 2147483648 & t, n = 1073741824 & e, r = 1073741824 & t, i = (1073741823 & e) + (1073741823 & t), n & r ? 2147483648 ^ i ^ a ^ o : n | r ? 1073741824 & i ? 3221225472 ^ i ^ a ^ o : 1073741824 ^ i ^ a ^ o : i ^ a ^ o
}
function d(e, t, n) {
return e & t | ~e & n
}
function e(e, t, n) {
return e & n | t & ~n
}
function f(e, t, n) {
return e ^ t ^ n
}
function g(e, t, n) {
return t ^ (e | ~n)
}
function h(e, t, n, r, a, o, i) {
return e = c(e, c(c(d(t, n, r), a), i)), c(b(e, o), t)
}
and i try to create the same method on php
function h($e, $t, $n, $r, $a, $o, $i) {
$e = c($e, c(c(d($t, $n, $r), $a), $i));
return c(b($e, $o), $t);
}
function g($e, $t, $n) {
return $t ^ ($e | ~$n);
}
function f($e, $t, $n) {
return $e ^ $t ^ $n;
}
function e($e, $t, $n) {
return $e & $n | $t & ~$n;
}
function b($e, $t) {
return ll($e, $t) | rrr($e, 32 - $t);
}
function c($e, $t) {
$a = 2147483648 & $e;
$o = 2147483648 & $t;
$n = 1073741824 & $e;
$r = 1073741824 & $t;
$i = (1073741823 & $e) + (1073741823 & $t);
$m = $n & $r ? 2147483648 ^ $i ^ $a ^ $o : $n;
$n = $r ? 1073741824 & $i ? 3221225472 ^ $i ^ $a ^ $o : 1073741824 ^ $i ^ $a ^ $o : $i ^ $a ^ $o;
return $m | $n;
}
function d($e, $t, $n) {
return $e & $t | ~$e & $n;
}
I try to call h() function on both language using this parameters
h(271733878,1608091569,4023233417,2562383102,32869,12,3905402710)
On javascript that function return -967207873, but on PHP that function return 3327756351. That function on positive numbers result, JS and PHP return the same integer, but i don't know why when result is negative number on JS, that function on both language doesn't match.
There is any mistake i do?