0

I'm working on this unofficial launcher for an old multiplayer game that used to be hosted by Gamespy (which is dead now). And we're trying to get it playable again for old times sake. We're using the open source RetroSpyServer to get the server's listed again, but now we want to load-in that information into our launcher.

The encryption class that's used to encrypt the server response list is https://github.com/GameProgressive/RetroSpyServer/blob/master/GameSpyLib/Encryption/GOAEncryption.cs

More specifically the function I need help with is the GOAEncryptByteShift.

private byte GOAEncryptByteShift(byte b)
    {
        byte swaptemp;
        State.ratchet = (byte)(State.ratchet + State.cards[State.rotor++]);
        swaptemp = State.cards[State.last_cipher];
        State.cards[State.last_cipher] = State.cards[State.ratchet];
        State.cards[State.ratchet] = State.cards[State.last_plain];
        State.cards[State.last_plain] = State.cards[State.rotor];
        State.cards[State.rotor] = swaptemp;
        State.avalanche = (byte)(State.avalanche + State.cards[swaptemp]);


        State.last_cipher =
            (byte)(b ^ State.cards[(State.cards[State.avalanche] + State.cards[State.rotor]) & 0xFF] ^
   State.cards[State.cards[(State.cards[State.last_plain] +
   State.cards[State.last_cipher] +
   State.cards[State.ratchet]) & 0xFF]]);
        State.last_plain = b;

        return State.last_cipher;
    }

It looks like it's an xor & and based encryption, and I have the secretKey, server & clientChallenge. But I can't seem to figure out how to reverse the byte-shift.

Any help would be highly appreciated!

  • Did you know that there is a reverse engineering SE site? – Maarten Bodewes May 14 '20 at 21:40
  • I didn't, thanks for pointing that out! – Wouter L May 15 '20 at 14:10
  • "Hi and welcome to RE.SE. Even though working with other peoples' legacy code can be a hard challenge, this doesn't classify as reverse engineering and is therefore off-topic here" - it's off-topic on RE.SE & dejunkers – Wouter L May 19 '20 at 15:12
  • Oh, sorry about that! If I'd expected it to be off topic here I would certainly not have suggested it. Thanks for the feedback, I'll keep it in mind. – Maarten Bodewes May 19 '20 at 15:40

0 Answers0