- substr: documentation ( source)
- chr: documentation ( source)
- hexdec: documentation ( source)
- ord: documentation ( source)
- sprintf: documentation ( source)
<?php
$prg_id = "781657";
$firstresult = '0';
$key = 6606;
$s = sprintf("%d", $prg_id);
for($i = 0; $i < strlen($s); $i++) {
$firstresult[$i] = chr(ord($s[$i]) ^ ($key>>8));
$key = (int)ord($firstresult[$i]) + (int)$key;
$key = (int)($key * 74102);
$key = (int)($key + 12337);
}
$ascii = $firstresult;
$len = strlen($ascii);
$result = "";
for ($i=0; $i<$len; $i++)
$result.=sprintf("%02x",ord(substr($ascii,$i,1)));
echo $result;
echo ' / ';
$hex = $result;
$key = 6606;
$result = '';
$len = strlen($hex);
for ($i=0; $i<$len; $i+=2)
$result.=sprintf("%s", chr(hexdec(substr($hex,$i,2))));
$firstresult = $result;
$result = '0';
for($i=0; $i <= strlen($firstresult)-1; $i++) {
$result[$i] = chr(ord($firstresult[$i]) ^ ($key>>8));
$key = (int)ord($firstresult[$i]) + (int)$key;
$key = (int)($key * 74102);
$key = (int)($key + 12337);
}
echo $result;