Opened 7 years ago

#7098 new Bugs

CRC: Initial values should not be reflected

Reported by: Dave Vasilevsky <dave@…> Owned by: Daryle Walker
Milestone: To Be Determined Component: crc
Version: Boost Development Trunk Severity: Problem
Keywords: Cc: dwalker


The CRC classes have a parameter 'ReflectIn?', which affects whether the message data is reflected. It also causes the initial remainder of the CRC to be reflected, and that's probably incorrect. This has likely remained undetected 'til now because all the included presets use bit-palindromic initial remainders.

LVM2 uses a non-palindromic initial remainder, so I've used its code for a test case. You can see that both LVM's calc_crc() and zlib's crc32() don't reflect the initial remainder. It's evident that boost's crc does, and that no obvious change in template parameters yields the same behaviour as LVM and zlib.

Tested in both clang++ 3.1 and g++ 4.2.

Attachments (1)

test.cpp (5.8 KB) - added by Dave Vasilevsky <dave@…> 7 years ago.
Test case

Download all attachments as: .zip

Change History (1)

Changed 7 years ago by Dave Vasilevsky <dave@…>

Attachment: test.cpp added

Test case

Note: See TracTickets for help on using tickets.