dreamworkAPI
Ctrl K
GitHub
classDocs / checksum / CRC16

checksum.CRC16

classsharedmenusource
Object → checksum.CRC8 → checksum.CRC16

The class used to create new CRC-16 checksum calculation instances.

Constructor

CRC16(poly: integer?, init: integer?, ref_in: boolean?, ref_out: boolean?, xor_out: integer?): checksum.CRC16

Fields

NameTypeDescription
DigestSizeintegerThe size of the checksum in bytes. = 2

Static functions

digestCalculates the CRC-16 checksum of the specified string.
MAXIMThe CRC-16 checksum class that uses MAXIM algorithm parameters.
USBThe CRC-16 checksum class that uses USB algorithm parameters.
XMODEMThe CRC-16 checksum class that uses XMODEM algorithm parameters.

#CRC16.digest

sharedmenunodiscardsource
function CRC16.digest(raw_str: string, poly?: integer, init?: integer, ref_in?: boolean, ref_out?: boolean, xor_out?: integer): integer

Calculates the CRC-16 checksum of the specified string.

Parameters
NameTypeDescription
raw_strstringThe string is used to calculate checksum.
polyoptionalintegerThe polynomial is used to calculate checksum.
initoptionalintegerThe initial value is used to calculate checksum.
ref_inoptionalbooleanWhether to reflect the input data before processing.
ref_outoptionalbooleanWhether to reflect the output data after processing.
xor_outoptionalintegerThe XOR value is used to calculate checksum.
Returns
TypeNameDescription
integerchecksumThe CRC-16 checksum, which is greater or equal to 0, and less than 2^16 (0x10000).

#CRC16.MAXIM

sharedmenunodiscardsource
function CRC16.MAXIM(): checksum.CRC16

The CRC-16 checksum class that uses MAXIM algorithm parameters.

Returns
TypeNameDescription
checksum.CRC16object

#CRC16.USB

sharedmenunodiscardsource
function CRC16.USB(): checksum.CRC16

The CRC-16 checksum class that uses USB algorithm parameters.

Returns
TypeNameDescription
checksum.CRC16object

#CRC16.XMODEM

sharedmenunodiscardsource
function CRC16.XMODEM(): checksum.CRC16

The CRC-16 checksum class that uses XMODEM algorithm parameters.

Returns
TypeNameDescription
checksum.CRC16object

Methods

digestFinalizes checksum calculation and returns the resulting checksum.
updateUpdates checksum with the specified string.

#CRC16:digest

sharedmenunodiscardsource
function checksum.CRC16:digest(): integer

Finalizes checksum calculation and returns the resulting checksum.

Returns
TypeNameDescription
integerchecksumThe final checksum value, which is greater or equal to 0, and less than 2^16 (0x10000).

#CRC16:update

sharedmenusource
function checksum.CRC16:update(raw_str: string): checksum.CRC16

Updates checksum with the specified string.

Parameters
NameTypeDescription
raw_strstringThe string is used to update checksum.
Returns
TypeNameDescription
checksum.CRC16self

Inherited methods

From checksum.CRC8 1

Subclasses

checksum.CRC32

Generated from the dreamwork meta branch.