[Q] Generic CRC-generation
JArchibald at aol.com
JArchibald at aol.com
Mon Dec 27 02:38:29 UTC 1999
--part1_0.754538e7.25982b25_boundary
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
=> 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.
Jerry.
+--------------------+
| Jerry L. Archibald |
+--------------------+---------+
| systemObjectivesIncorporated |
+------------------------------+
--part1_0.754538e7.25982b25_boundary
Content-Type: text/plain; name="CRC26D~1.ZIP"
; x-mac-type="705A4950"
; x-mac-creator="705A4950"
Content-Disposition: attachment; filename="CRC26D~1.ZIP"
Content-Transfer-Encoding: imap_stub
0,2665,2,8040,0,
--part1_0.754538e7.25982b25_boundary--
More information about the Squeak-dev
mailing list
|