Need help with Arma2 Rcon Class PHP

mirko911

New Member
Hey everybody,

I'm working on a rcon tool for arma2 and I need help with the crc32 checksum.
Atm, I can send commands over the class and receive the response, but I also want to catch the server messages (0x02).

Atm my problem is, that I receive the messages but the acknowlege seems to fail.
I checked it with wireshark, the answer (0x02 . 0x00) is correct, only the crc is different from the other rcon tool. That's crazy because my login query matchs with the other rcon tool. Only acknowledge fails

That's the acknowlege udp dump of the working rcon tool (DaRT)
Code:
42 45 eb bf e8 04 ff 02  01                      BE...... .
And this is my tool
Code:
42 45 0b fe 8b e4 ff 02  01                      BE...... .
it's weird because the chars of the crc are the same, only an other order

and here is my code
PHP:
    public function acknowledge($msg) {
        $this->send($this->buildPacket($msg[7] . $msg[8])); //msg7 = 2  || msg8 = counter
    }
 
    public function generateChecksum($str) {

        sscanf(crc32($str), "%u", $var);
        $var = dechex($var + 0);

        $x = ('0x');
        $a = substr($var, 0, 2);
        $a = $x . $a;
        $b = substr($var, 2, 2);
        $b = $x . $b;
        $c = substr($var, 4, 2);
        $c = $x . $c;
        $d = substr($var, 6, 2);
        $d = $x . $d;
        return chr($d) . chr($c) . chr($b) . chr($a);
    }
 
    public function buildPacket($packet) {
        $packet = chr(0xff) . $packet;
        return $this->generateChecksum($packet) . $packet;
    }
 
    public function send($packet) {
        fwrite($this->fp, "BE" . $packet);
    }

Maybe you've an idea what's wrong with the crc32 code

EDIT: not possible with PHP CRC32() Function
 
Last edited:
Back
Top