dreamworkAPI
Ctrl K
GitHub
classDocs / checksum / CRC8

checksum.CRC8

classsharedmenusource
Object → checksum.CRC8

The CRC-8 checksum calculation object.

Constructor

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

Fields

NameTypeDescription
DigestSizeintegerThe size of the checksum in bytes. = 1

Static functions

CDMA2000The CRC-8 checksum class that uses CDMA2000 algorithm parameters.
digestCalculates the CRC-8 checksum of the specified string.
MAXIMThe CRC-8 checksum class that uses MAXIM algorithm parameters.
ROHCThe CRC-8 checksum class that uses ROHC algorithm parameters.

#CRC8.CDMA2000

sharedmenunodiscardsource
function CRC8.CDMA2000(): checksum.CRC8

The CRC-8 checksum class that uses CDMA2000 algorithm parameters.

Returns
TypeNameDescription
checksum.CRC8object

#CRC8.digest

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

Calculates the CRC-8 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 of checksum.
ref_inoptionalbooleantrue if input checksum is reversed, otherwise false.
ref_outoptionalbooleantrue if output checksum is reversed, otherwise false.
xor_outoptionalintegerThe value to be XORed with output checksum.
Returns
TypeNameDescription
integerchecksumThe CRC-8 checksum, which is greater or equal to 0, and less than 2^8 (0x100).

#CRC8.MAXIM

sharedmenunodiscardsource
function CRC8.MAXIM(): checksum.CRC8

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

Returns
TypeNameDescription
checksum.CRC8object

#CRC8.ROHC

sharedmenunodiscardsource
function CRC8.ROHC(): checksum.CRC8

The CRC-8 checksum class that uses ROHC algorithm parameters.

Returns
TypeNameDescription
checksum.CRC8object

Methods

digestFinalizes checksum calculation and returns the resulting checksum.
resetResets checksum to the initial value.
updateUpdates checksum with the specified string.

#CRC8:digest

sharedmenunodiscardsource
function checksum.CRC8: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^8 (0x100).

#CRC8:reset

sharedmenusource
function checksum.CRC8:reset(): checksum.CRC8

Resets checksum to the initial value.

Returns
TypeNameDescription
checksum.CRC8self

#CRC8:update

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

Updates checksum with the specified string.

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

Subclasses

checksum.CRC16

Generated from the dreamwork meta branch.