Salesforce

CRC (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

CRC (Magic xpa 2.x)

Performs a cyclic redundancy check value on an Alpha string.

Syntax:

CRC(string,numeric)

Parameters:

string : An alpha string to which the CRC is applied.

numeric: A number that represents the CRC algorithm. Use 0 to apply CRC-16.

Returns:

2-byte string containing the CRC value.

Example:

  1. Send ABC&CRC('ABC',0)
    Call it string

  2. At the receiving end, ask whether
    CRC(Left(string,3),0)=Right(string,2)

Note:

CRC is used primarily for verification of a data stream. Since the function's algorithm uses all the elements of the input string for the calculation, the result can serve as a reliable measure for ensuring that the string is not altered.

A common application for CRC is communication between two computers. In order to verify that the data transmitted has actually arrived intact, calculate a CRC value from the data prior to transmission. Then append the CRC word (2 bytes) to the information, and transmit. On the receiving side, strip off the CRC information, and calculate a CRC value of the remaining data. If the CRC calculated from the received data and the CRC received with the data match, then there were no faults detected during transmission. If the two CRC values do not match, then the data probably was corrupted during transmission.

See also:

ChkDgt

The Online and Rich Client Samples projects (program ST02 and RST02)

Reference
Attachment 
Attachment