[Q] Generic CRC-generation

Douglas McPherson djm at san.rr.com
Wed Dec 29 17:59:55 UTC 1999


Maurice and Jerry,

Not one, but two completely general CRC packages!  Thank you, thank 
you, thank you. The only thing for me to add is the ability to 
compute CRCs over bit fields whose width is not an integer multiple 
of 8 (suggestions welcome). My approach is going to be to compute the 
CRC over as many bytes as possible, then add in the effect of the 
final bits.

Again, thank you both very much.

Doug.


>=> 12/22/99 1:00:59 PM EST, djm at san.rr.com =>
><< Does anybody out there have code for generic CRC generation? The
> implementation does not have to be efficient. I am aware of the
> 16-bit algorithm in the current image, but need to be able to
> generate CRCs with non-standard polynomials for arbitrary bit length
> messages. Thanks in advance. >>
>
>Doug,
>
>Attached is CRC package I did a while ago.
>I hacked a change to remove BitMasks Class Variable from class Integer;
>  it wouldn't load on 2.6 otherwise. 2.7a fixes bug. Much slower table
>  creation without that Class Variable. It cached BitMasks (1-bit in a width
>of 0s).
>This is based rather strictly on the paper by Ross N. Williams.
>I built the table driven version and then went back and added  
>  the reference version from the paper to fully document the program.
>I later added an 'incremental' version <processes crc's a character at a time,
>  but uses tables for calculating intermediate results>.
>There are various test methods to execute internal tests; they are probably
>  the best way to figure out how to add your own needs to the package..
>------------------------------------------
>I've taken a quick look at Maurice's package.
>His algorithms are based on
>  Peterson & Weldon's 'Error Correction Codes'
>  so the packages look different when setting up your own crc processor.
>His goal of using 30 bits for intermediate results is definitely
>  the right way to go for Squeak (with 2 extra bits over SmallInteger in
>  a 32-bit word) so I'll have to figure out how he does the algorithm.
>
>





More information about the Squeak-dev mailing list