Fletcher32
Object → Fletcher16 → Fletcher32
The Fletcher-32 checksum calculation object.
Constructor
Fletcher32(): Fletcher32Fields
| Name | Type | Description |
|---|---|---|
DigestSize | integer | = 4 |
Static functions
#Fletcher32.digest
function Fletcher32.digest(raw_str: string): integer
Calculates the Fletcher-32 checksum of the specified string.
Parameters
| Name | Type | Description |
|---|---|---|
raw_str | string | The string is used to calculate checksum. |
Returns
| Type | Name | Description |
|---|---|---|
integer | checksum | The checksum value, which is greater or equal to 0, and less than 2^32 (0x100000000). |
Methods
digest | Finalizes checksum calculation and returns the resulting checksum. |
reset | Resets checksum to the initial value. |
update | Updates checksum with the specified string. |
#Fletcher32:digest
function Fletcher32:digest(): integer
Finalizes checksum calculation and returns the resulting checksum.
A trailing odd byte is padded with zero.
Returns
| Type | Name | Description |
|---|---|---|
integer | checksum | The final checksum value, which is greater or equal to 0, and less than 2^32 (0x100000000). |
#Fletcher32:reset
function Fletcher32:reset(): Fletcher32
Resets checksum to the initial value.
Returns
| Type | Name | Description |
|---|---|---|
Fletcher32 | self |
#Fletcher32:update
function Fletcher32:update(raw_str: string): Fletcher32
Updates checksum with the specified string.
The data is processed as little-endian 16-bit words.
Parameters
| Name | Type | Description |
|---|---|---|
raw_str | string | The string is used to update checksum. |
Returns
| Type | Name | Description |
|---|---|---|
Fletcher32 | self |