Jump to content

PHP Commands


Gexe

Recommended Posts

Can SOme1 Please Decode This

 

 

// DECODE
        if (strlen($packet) < 1)
            return false;
        $packet = str_split($packet);
        foreach ($packet as &$char){
            $char = ord($char);
            $char -= 128;
            if ($char < 0)
                $char = 256 + $char;
        }
        $newpacket = '';
        $i = 0;
        while ($i < count($packet)){
            $newpacket[] = $packet[$i];
            $i += 2;
        }
        $i -= 1;
        if(count($packet) % 2)
            $i = count($packet)-2;
        while ($i > 0){
            $newpacket[] = $packet[$i];
            $i -= 2;
        }
        foreach ($newpacket as &$char)
            $char = chr($char);
        return implode('',$newpacket);

// ENCODE
        if (strlen($packet) < 1)
            return false;
        $packet = str_split($packet);
        foreach ($packet as &$char){
            $char = ord($char);
            $char -= 128;
            if ($char < 0) 
                $char = 256 + $char;
        }
        $newpacket = '';
        $i = 0;
        $j = 0;
        while ($i < count($packet)){
            $newpacket[$i] = $packet[$j];
            $i += 2;
            $j++; 
        }
        $i -= 3;
        if(!(count($packet) % 2))
            $i = count($packet)-1;
        while ($i > 0){
            $newpacket[$i] = $packet[$j];
            $i -= 2;
            $j++;
        }
        ksort($newpacket);
        foreach ($newpacket as &$char)
            $char = chr($char);
        return implode('',$newpacket); 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.