Skip to main content
Previous section   Next section

CHECKSUM

Returns a checksum number for a string.

Synopsis

CHECKSUM(string)

Arguments

string An expression that resolves to a string.

Description

The CHECKSUM function generates a cyclic redundancy code (also called a checksum) corresponding to string. It returns this checksum as a positive 5-digit integer. A checksum can be used to determine if data has been modified or if it was incompletely transmitted. CHECKSUM uses an 8-bit byte sum mode to calculate the checksum.

CHECKSUM returns the same checksum number for a numeric and the corresponding numeric string. However, numerics are converted to canonical form before checksum processing, whereas numeric strings are not converted to canonical form. Canonical and non-canonical forms of the same number have different checksums.

All string and numeric values, including zero, return a 5-digit checksum. However, if string is a null string a checksum of 0 is returned.

Examples

The following examples all return the same checksum:

PRINT CHECKSUM(123.4)
PRINT CHECKSUM("123.4")
PRINT CHECKSUM(+00123.400)
Copy code to clipboard

The following examples do not return the same checksum:

PRINT CHECKSUM(123.400)
PRINT CHECKSUM("123.400")
Copy code to clipboard

See Also