[comp.sys.ibm.pc] CRC checksums

jwbirdsa@phoenix.Princeton.EDU (James Webster Birdsall) (01/11/89)

   Can somebody either tell me or point me to references on how to
compute a CRC checksum for a block of characters? Fast algorithms would
be much appreciated. :-)
   Thanks...


========================================================================
! James W. Birdsall               Compu$erve:  71261,1731              !
! jwbirdsa@phoenix.Princeton.EDU  jwbirdsa@bogey.Princeton.EDU         !
! jwbirdsa@pucc.BITNET            ...allegra!princeton!phoenix!jwbirdsa!
========================================================================
!  When God wrote the Universe, He did so in C on a UNIX system, which !
!  is why it took him six all-nighters and he slept all day afterward. !
!  However, it _has_ been functioning without patching for somewhat    !
!  more than four billion years now...                                 !
========================================================================

hardin@hpindda.HP.COM (John Hardin) (01/12/89)

 James Webster Birdsall  writes:

>Can somebody either tell me or point me to references on how to
>compute a CRC checksum for a block of characters? 
----------

For a fast method, you might want to look at the article "A Table
Driven Approach to Cyclic Redundancy Check Calculations" by J. R. Hill
in the April 1979 copy of Computer Communication Review, a 
publication of the ACM SIGCOM.  The larger the table you use, the
larger the amount of data you can process at a time (i.e., the 
faster you go).  This article also has a bibliography of 5 other
sources of information on CRCs.

John Hardin
hardin%hpindda@hplabs.hp.com

henk@bebux.UUCP (Henk Dijkstra) (01/13/89)

In article <5303@phoenix.Princeton.EDU> jwbirdsa@phoenix.Princeton.EDU (James Webster Birdsall) writes:
>
>   Can somebody either tell me or point me to references on how to
>compute a CRC checksum for a block of characters? Fast algorithms would
>be much appreciated. :-)
>   Thanks...

Here is an Outline:
* This is a parallel CRC-computing function
* For a 8-bit CRC you could use a generator polynome of: X8 + X4 + X3 + 1
* Or 19H (X4+X3+1) X8=carry.
* 
START:
	CRC-Reg = 0
LOOP:
	shift left CRC-Reg for 1 position
	Was the MSB of CRC-Reg clear? (Carry=0?)
		THEN   EXOR CRC-Reg with Polynome (19H)
	EXOR CRC-Reg with memory cell
	Was last memory cell done?
		NO  increment memory pointer by 1 and goto LOOP:
		YES CRC now in CRC-Reg.


From: D.Leisengang; Signaturanalyse in der Datenverarbeitung.

-- 
Henk Dijkstra	: BETRONIC B.V.			USENET : henk@bebux.UUCP
		: PO-box 4317				 ..!hp4nl!bebux!henk
		: 1009 AH AMSTERDAM, NL		VOICE  : (+31) 20 6652251
--------------------------------------------------------------------------------