Indy 9
TIdHashCRC16
Hierarchy, Methods, See Also, Unit: IdHashCRC
Implements methods used to calculate a 16-bit CRC value for data in an input stream.
TIdHashCRC16 = class(TIdHash16)
Unit
IdHashCRC
Description
TIdHashCRC16 is a TIdHash16 descendant that implements methods used to calculate a 16-bit Cyclic Redundnacy Check (CRC) value for data in an input stream. TIdHashCRC16 uses a pre-computed 512-byte lookup table for faster calculation of CRC values.

TIdHashCRC16.HashValue
TIdHashCRC16
Implements calculation of the 16-bit CRC value for a block of data.
function HashValue(AStream: TStream): Word; override;
Parameters
AStream: TStream
Stream containing the data to be used for the CRC calculation.
Return Value
Word - 16-bit CRC value calculated from the input data.
Description
HashValue is an overridden Word function in TIdHashCRC16 that implements calculation of the 16-bit CRC value for a block of data. HashValue reimplements the inherited method to use the pre-computed table of 16-bit CRC values for all 256 possible character combinations that can be represented in a byte from the input data. HashValue calculates the CRC result by performing an exclusive OR for the current CRC value and the precomputed CRC value in the table for low nibble of the current input data.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.