Opened 10 years ago
#7098 new Bugs
CRC: Initial values should not be reflected
Reported by: | Owned by: | Daryle Walker | |
---|---|---|---|
Milestone: | To Be Determined | Component: | crc |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: | dwalker |
Description
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.
Test case