Wireshark-dev: [Wireshark-dev] Calculating CRC5 of 11-bit data

From: Tomasz Moń <desowin@xxxxxxxxx>
Date: Fri, 19 Jul 2019 18:26:49 +0200
Hello,

I am currently working on USB Link Layer dissector. It is supposed to
be used with OpenVizsla FPGA-based USB hardware sniffer. USB Packets
feature two CRC types: CRC-5/USB and CRC-16/USB.

The CRC-16/USB is pretty straightforward. I have implemented it in [1]
and it works fine with my captures.

The CRC-5/USB is not so straightforward as it does not operate on the
byte boundary. The CRC-5/USB is calculated on 11 bits of data. I think
there are two possible approaches to check the CRC-5/USB in Wireshark:
1. Compute the CRC5 bitwise on the 11 bits of data, or
2. Compute the CRC5 with table-based algorithm on 2 bytes (11 bits
data + 5 bits CRC) and relying on the CRC properties expect fixed
output.

Which approach would be preferred?

Best Regards,
Tomasz Moń

[1] https://code.wireshark.org/review/#/c/34016/