@ 2013-12-14T00:42:44Z <?php
// Unicode/multibyte capable equivelant of ord().
function charCodeAt($a, $b) {
$a = mb_convert_encoding($a,"UCS-4BE","UTF-8");
$c = unpack("N", mb_substr($a,$b,1,"UCS-4BE"));
return $c[1];
}
// strToNum - Convert a string into a 32-bit integer.
function strToNum ($str, $c, $k)
{
$Int32U = 4294967296; // 2^32
for ($i = 0; $i < mb_strlen($str); $i++) {
$c *= $k;
if ($c >= $Int32U) {
$c = $c - ($Int32U * (int) ($c / $Int32U));
// if $c is less than -2^31
$c = ($c < 0x0000000080000000) ? ($c + $Int32U) : $c;
}
$c += charCodeAt($str, $i);
}
return $c;
}
function string_inthash($str)
{
$a = (int)preg_replace('#[^0-9]#u', '', sha1($str)) * (int)date('YmdHis');
if (PHP_INT_MAX != 0x0000000080000000) { // 2147483647
$a = -(~($a & 0x00000000FFFFFFFF) + 1);
}
return (int)$a;
}
$str = 'secret';
echo strToNum($str, 0x1505, 0x21);
/*
$a = date('YmdHi');
$b = 'secret';
$bb = sha1($b);
$bc = preg_replace('#[^0-9]#u', '', $bb);
$bd = (int)$bc - (int)$a;
$c = "{$b}|{$a}";
$d = base64_encode($c);
$e = base64_decode($d);
echo $a . PHP_EOL;
echo $b . PHP_EOL;
echo $bb . PHP_EOL;
echo $bc . PHP_EOL;
echo $bd . PHP_EOL;
echo $c . PHP_EOL;
echo $d . PHP_EOL;
echo $e . PHP_EOL;
*/
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 4.3.5 - 4.3.11 , 4.4.0 - 4.4.9 , 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.37 , 5.6.0 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.27 , 8.2.0 - 8.2.17 , 8.3.0 - 8.3.4 4756089835 Output for 4.3.0 - 4.3.4 Notice: Undefined offset: 1 in /in/kQtYI on line 6
Notice: Undefined offset: 1 in /in/kQtYI on line 6
Notice: Undefined offset: 1 in /in/kQtYI on line 6
Notice: Undefined offset: 1 in /in/kQtYI on line 6
Notice: Undefined offset: 1 in /in/kQtYI on line 6
Notice: Undefined offset: 1 in /in/kQtYI on line 6
4427023557 preferences:dark mode live preview
260.26 ms | 402 KiB | 391 Q