Информационный сервер для программистов: Исходники со всего света. Паскальные исходники со всего света
  Powered by Поисковый сервер Яndex: Найдется ВСЁ!
На Главную Исходники Форум Информер Страны мира
   Контрольные Суммы    >>    crcasm
   
 
 CRC16, CRC32 and CRC/ARC functions   Edwin T. Floyd 29.10.1989

Три оптимизированные по скорости функции для вычисления CRC16 и CRC32.
Three speed-optimized assembler functions to compute a CRC:
CRC16 - used by the XModem protocol,
CRC32 - used by PKZIP and Forsberg's ZModem,
CRC/ARC - used by SEA's ARC utility.



12k 
 

This unit provides three speed-optimized functions to compute (or continue computation of) a Cyclic Redundency Check (CRC). These routines are contributed to the public domain (with the limitations noted by the original authors in the TASM sources). Please see TESTCRC.PAS for example usage. Each function takes three parameters: InitCRC - The initial CRC value. This may be the recommended initialization value if this is the first or only block to be checked, or this may be a previously computed CRC value if this is a continuation. InBuf - An untyped parameter specifying the beginning of the memory area to be checked. InLen - A word indicating the length of the memory area to be checked. If InLen is zero, the function returns the value of InitCRC. The function result is the updated CRC. The input buffer is scanned under the limitations of the 8086 segmented architecture, so the result will be in error if InLen > 64k - Offset(InBuf). These conversions were done on 10-29-89 by: Edwin T. Floyd [76067,747] #9 Adams Park Court Columbus, GA 31909 (404) 576-3305 (work) (404) 322-0076 (home) Interface Function UpdateCRC16(InitCRC: Word; Var InBuf; InLen : Word) : Word; { I believe this is the CRC used by the XModem protocol. The transmitting end should initialize with zero, UpdateCRC16 for the block, Continue the UpdateCRC16 for two nulls, and append the result (hi order byte first) to the transmitted block. The receiver should initialize with zero and UpdateCRC16 for the received block including the two byte CRC. The result will be zero (why?) if there were no transmission errors. (I have not tested this function with an actual XModem implementation, though I did verify the behavior just described. See TESTCRC.PAS.) } Function UpdateCRCArc(InitCRC: Word; Var InBuf; InLen: Word) : Word; { This function computes the CRC used by SEA's ARC utility. Initialize with zero. } Function UpdateCRC32(InitCRC: LongInt; Var InBuf; InLen: Word): LongInt; { This function computes the CRC used by PKZIP and Forsberg's ZModem. Initialize with high-values ($FFFFFFFF), and finish by inverting all bits (Not). }