> I seem to remember there was something special with the polynomial that forced you byteswap the data.
That's correct, coreutils uses the normal polynomial, gnulib uses the bit-reversed polynomial, and gzip uses gnulib directly as the RFC 1952 specifies the bit-reversed polynomial. Both use the standard CRC32 polynomial. Using the reversed polynomial means byte swapping is not required on little endian systems (which reminds me, I need to handle big-endian in my slice-by-8 algorithm) On Wed, 16 Oct 2024 at 12:18, Kristoffer Brånemyr <zti...@yahoo.se> wrote: > > Den onsdag 16 oktober 2024 kl. 08:43:03 CEST, Simon Josefsson < > si...@josefsson.org> skrev: > > > Pádraig Brady <p...@draigbrady.com> writes: > > > > > > > In general gnulib focuses on portable routines, so for example leaves > > > platform specific crypto optimizations to libcrypto, only providing > fallback > > > cross platform implementations where needed. > > > > > > OpenSSL libcrypto doesn't provide CRC, does it? > > > > I agree with what you say, but I think in this example, I think it makes > > sense for gnulib to provide a optimized CRC function that may contain > > architecture-specific optimizations. The reason seems to be that while > > there are numerous different optimized implementations around, few seems > > to be arranged in a re-usable fashion. > > > > The barrier for acceptance in gnulib may be higher than in some > > individual projects since gnulib is intended to be highly portable and > > flexible, and this requires extra care when doing the implementation. > > But there are examples of arch-specific assembler code in gnulib > > already. > > > > There are some earlier efforts related to CRC for gzip which may be > > useful to re-read: > > > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67022 > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39831 > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41535 > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72588 > > > > /Simon > > Which CRC version did you plan to put into gnulib by the way? There are > many different polynomials in use. CRC32 and CRC32C for instance use > different polynomials. I don't remember which polynomial the routine in > cksum used, but I think it was CRC32, but I seem to remember there was > something special with the polynomial that forced you byteswap the data. > > /Kristoffer >