Function boxcars::crc::calc_crc [] [src]

pub fn calc_crc(data: &[u8]) -> u32

Calculates the crc-32 for rocket league replays. Not all CRC algorithms are the same. The crc algorithm can be generated with the following parameters (pycrc):

  • Width = 32
  • Poly = 0x04c11db7
  • XorIn = 0x10340dfe
  • ReflectIn = False
  • XorOut = 0xffffffff
  • ReflectOut = False

It may be tempting to optimize this function to use slice by techniques, but I have not be able to achieve this. pycrc disables slice by for non-reflected algorithms, and I couldn't get the reversed model from reveng to pass the tests. I've wasted too much time trying to optimize this function. I thought it would be worthwhile as when one is only interested in parsing a replay's header and checking the crc, the crc computation is 100x more intensive than the header parsing.

I've even tried to lookup the slice by 8 tables of CRCTablesSB8 and CRCTablesSB8_DEPRECATED from the unreal engine to glean any information on derivation or usage. They can be found in the AHRUnrealEngine Github repo. I've copied them and the usage in MemCrc_DEPRECATED faithfully, but no luck. This has been a teachable moment