-
Notifications
You must be signed in to change notification settings - Fork 14
CRC32
The SOE protocol uses a seeded CRC32 algorithm. The seed is a random number generated by the server and sent to new connections in the Session Response packet. The CRC key is also used in encryption.
Some packets require that certain bytes of the CRC32 are appended to the end of the packet to ensure the data was received correctly. This is done automatically through SOEWriter when calling GetFinalSOEPacket. However, if you need to get the CRC32 of a piece of data for something other than the footer, it can be done using the GetAppendedCRC32 method from an instance of SOEClient which will return the byte array with the length of the client's CRC Length. If you need the entire CRC32, use GetCRC32Checksum.
Found in SOEProtocol. Look in there for the static CRCTable.
public uint GetCRC32Checksum(uint crcSeed, byte[] packet)
{
uint nCrc = CRCTable[(~crcSeed) & 0xFF];
nCrc ^= 0x00FFFFFF;
uint nIndex = (crcSeed >> 8) ^ nCrc;
nCrc = (nCrc >> 8) & 0x00FFFFFF;
nCrc ^= CRCTable[nIndex & 0xFF];
nIndex = (crcSeed >> 16) ^ nCrc;
nCrc = (nCrc >> 8) & 0x00FFFFFF;
nCrc ^= CRCTable[nIndex & 0xFF];
nIndex = (crcSeed >> 24) ^ nCrc;
nCrc = (nCrc >> 8) & 0x00FFFFFF;
nCrc ^= CRCTable[nIndex & 0xFF];
for (int i = 0; i < packet.Length; i++)
{
nIndex = packet[i] ^ nCrc;
nCrc = (nCrc >> 8) & 0x00FFFFFF;
nCrc ^= CRCTable[nIndex & 0xFF];
}
return ~nCrc;
}Connection Handshake
Data Types
~~. What is a Packet?
01. Session Request
02. Session Response
03. Multi
05. Disconnect
09. Reliable Data
0D. Fragmented Reliable Data
15. Reliable Data Acknowledge
~~. What is a Message?
19. Multi-data
Free Realms (Coming Soon...)
Star Wars Galaxies
Vanguard: Saga of Heroes