[comp.sys.mac.programmer] Calculating checksums/crc's for Binhex

jtn@ADS.COM (John T. Nelson) (01/28/91)

>Newsgroups: comp.sys.mac.programmer
>From: niko@iastate.edu (Schuessler Nikolaus E)
>Subject: Writing a BinHex decoder
>
>I was trying to write a BinHex decoder (actually I successfully did), but
>had a few questions:
>
>  1)  How do you calculate the crc's? I thought a CRC was just a matter
>      of adding up all the bytes in the field to be checked, (I let
>      the integer wrap around when I added), but the crc is nowhere close
>      to what it's supposed to be. The files are decoded just fine, the
>      crc's just aren't checked.

I think you're confused.  What you've just described is a simple
checksum, not a CRC.  Cyclical Redunancy Checks are polynomial
expansions and are MUCH more complicated.  Check out a reference book
on the subject sometime.  You'll be amazed.  You also won't understand
at first glance why this thing actually works but that's okay... they
do.


--
ORGANIZATION:  Advanced Decision Systems   GEOGRAPHIC: Arlington, VA
UUCP:          kzin!speaker@mimsy.umd.edu  INTERNET:   jtn@potomac.ads.com
SPOKEN:        John T. Nelson              PHONE:      (703) 243-1611