Print Page as PDF
XLFCRC ICR (3156)

XLFCRC    ICR (3156)

Name Value
NUMBER 3156
IA # 3156
DATE CREATED 2000/08/04
CUSTODIAL PACKAGE KERNEL
CUSTODIAL ISC San Francisco
USAGE Supported
TYPE Routine
DBIC APPROVAL STATUS APPROVED
ROUTINE XLFCRC
NAME XLFCRC
GENERAL DESCRIPTION
This routine has two API's, CRC32 and CRC16.

SET CRC=$$CRC32^XLFCRC(string)

A check-sum can also be calculated over multiple strings.
SET (I,C)=0
FOR  SET I=$ORDER(X(I)) QUIT:'I  DO
. SET C=$$CRC16^XLFCRC(X(I),C)

or
SET I=0,C=4294967295
FOR  SET I=$ORDER(X(I)) QUIT:'I  DO
. SET C=$$CRC32^XLFCRC(X(I),C)

as long as the save method is used all the time.

These have been approved for inclusion in a future ANSI M[UMPS] language
standard as part of the library.
STATUS Active
KEYWORDS CRC
ID XLFCRC
COMPONENT/ENTRY POINT
COMPONENT/ENTRY POINT COMPONENT DESCRIPTION VARIABLES
$$CRC32(string[,seed])
This function computes a Cyclic Redundance Code of
the 8-bit character string string, using X^32 + X^26 + X^23 + X^22 + X^16 +
X^12 + X^11 + X^10 + X^8 + X^7 + X^5 + X^4 + X^2 + X + 1 as the polynominal.
The optional parameter seed may supply an initial value, which allows for
running CRC calculations on multiple strings.  If the  parameter seed is not
specified, a default value of 4,294,967,295 (2^32-1) is assumed.  The value of
seed is limited to 0 <= seed <= 2^32.  The function value will be between 0
and 2^32.
VARIABLES TYPE VARIABLES DESCRIPTION
string Input
String to compute the CRC32 on.
seed Input
Optional seed value,
Needed to compute the CRC32 over multiple strings.
$$CRC16(string[,seed])
This function computes a Cyclic Redundance Code of
the 8-bit character string string, using X^16 + X^15 + X^2 + 1as the
polynominal.  The optional parameter seed may supply an initial value, which
allows for running CRC calculations on multiple strings.  If the  parameter
seed is not specified, a default value of 0 is assumed. The value of seed is
limited to 0 <= seed <= 2^16.  The function value will be between 0 and 2^16.
VARIABLES TYPE VARIABLES DESCRIPTION
string Input
String to compute the CRC16 on.
seed Input
Optional seed value.  Needed to compute the CRC16
over multiple strings.
DATE ACTIVATED 2007/11/06