Re: [RFC 3/7] lib: add rocksoft model crc64

From: Keith Busch
Date: Tue Jan 25 2022 - 10:42:58 EST


On Mon, Jan 24, 2022 at 09:10:38PM -0800, Eric Biggers wrote:
> On Mon, Jan 24, 2022 at 08:01:03AM -0800, Keith Busch wrote:
> > Since this model reflects inputs and outputs, a helper table and
> > function are added to reverse bits of 8 and 64 bit values.
>
> That's a silly way to do a bit-reflected CRC. The proper way to do it is to
> reflect the bytes too, so that the bits and bytes are ordered consistently, so
> explicitly reflecting the bits isn't needed. Most CRC-32's are bit-reflected,
> and they are usually implemented this way. E.g., see crc32_le() in lib/crc32.c.
>
> Here's a Python script that shows that the Rocksoft CRC-64 can be computed
> without explicitly reversing the bits. It passes the tests from your patch 4:

Thanks for the tip! I'll use that for the next version.