-
Notifications
You must be signed in to change notification settings - Fork 39
Description
This is part feature request, part "I don't really know what I'm doing" :)
I'm playing around with some code to port parts of bzip2 to Rust. Its hand-written crc32 code looks like this: https://gitlab.com/federicomenaquintero/bzip2/blob/e4cdd603608e8dc87a526d287369775601c63df9/crc32.c
Here is a test with a few computed checksums: https://gitlab.com/federicomenaquintero/bzip2/blob/e4cdd603608e8dc87a526d287369775601c63df9/crc32test.c
I think this is a different CRC order than what crc32fast uses. After getting help, someone kindly suggested using the custom constructor from the crc crate: https://gitlab.com/federicomenaquintero/bzip2/blob/6ef10026a74af85437a4deca6957889d9e8bdbf8/bzlib_rust/src/lib.rs
That last link has Rust code that computes the same CRC32 values as the original C code. I would rather use crc32fast for this, of course, and maybe speed up bzip2 as a result :)
Would it be possible for crc32fast to provide enough machinery to replace this kind of C code which has any random variant of CRC32?