我正在为一个旧的多人游戏开发这个非官方的启动器,该游戏曾经由 Gamespy 托管(现在已经死了)。而且我们正试图让它再次可玩,因为旧时代的缘故。我们正在使用开源 RetroSpyServer 再次列出服务器,但现在我们想将该信息加载到我们的启动器中。
用于加密服务器响应列表的加密类是https://github.com/GameProgressive/RetroSpyServer/blob/master/GameSpyLib/Encryption/GOAAncryption.cs
更具体地说,我需要帮助的功能是 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;
}
看起来它是一个基于 xor & and 的加密,我有 secretKey、server 和 clientChallenge。但我似乎无法弄清楚如何扭转字节移位。
任何帮助将不胜感激!