dreamworkAPI
Ctrl K
GitHub
classDocs / Fletcher32

Fletcher32

classsharedmenusource
Object → Fletcher16 → Fletcher32

The Fletcher-32 checksum calculation object.

Constructor

Fletcher32(): Fletcher32

Fields

NameTypeDescription
DigestSizeinteger = 4

Static functions

#Fletcher32.digest

sharedmenunodiscardsource
function Fletcher32.digest(raw_str: string): integer

Calculates the Fletcher-32 checksum of the specified string.

Parameters
NameTypeDescription
raw_strstringThe string is used to calculate checksum.
Returns
TypeNameDescription
integerchecksumThe checksum value, which is greater or equal to 0, and less than 2^32 (0x100000000).

Methods

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

#Fletcher32:digest

sharedmenunodiscardsource
function Fletcher32:digest(): integer

Finalizes checksum calculation and returns the resulting checksum.

A trailing odd byte is padded with zero.

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

#Fletcher32:reset

sharedmenusource
function Fletcher32:reset(): Fletcher32

Resets checksum to the initial value.

Returns
TypeNameDescription
Fletcher32self

#Fletcher32:update

sharedmenusource
function Fletcher32:update(raw_str: string): Fletcher32

Updates checksum with the specified string.

The data is processed as little-endian 16-bit words.

Parameters
NameTypeDescription
raw_strstringThe string is used to update checksum.
Returns
TypeNameDescription
Fletcher32self
Generated from the dreamwork meta branch.