I'm writing a Node.js application that receives WebSocket messages from a third-party. The messages include a CRC32C checksum value, and I've received this brief intstruction on how to generate the message checksum:
Generate checksum with generate_crc32c algorithm:
checksum = generate_crc32c(messageAsString, strlen);
Where the above value messageAsString is a stringified version of parts of the JSON WebSocket message. The instructions do not explain what the strlen value is, or how it is generated. I'm also not sure if the above is a particular language or psuedo-code. I've tried and failed to get more specific instructions from the third party.
To generate the checksum, I'm using the Node.js module fast-crc32c and very simply doing this:
const crc32c = require('fast-crc32c');
// .. generate `messageAsString` val
const calcChecksum = crc32c.calculate(messageAsString);
The problem is that I've tested several messages, and the checksums never match. Am I missing something about how this checksum value should be generated? Is the strlen value important? I can't find any docs on what it is. Am I most definitely getting the messageAsString value wrong?