Fletcher16
Object → Fletcher16
The Fletcher-16 checksum calculation object.
Constructor
Fletcher16(): Fletcher16Fields
| Name | Type | Description |
|---|---|---|
DigestSize | integer | The size of the checksum in bytes. = 2 |
Static functions
#Fletcher16.digest
function Fletcher16.digest(raw_str: string): integer
Calculates the Fletcher-16 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^16 (0x10000). |
Methods
digest | Finalizes checksum calculation and returns the resulting checksum. |
reset | Resets checksum to the initial value. |
update | Updates checksum with the specified string. |
#Fletcher16:digest
function Fletcher16:digest(): integer
Finalizes checksum calculation and returns the resulting checksum.
Returns
| Type | Name | Description |
|---|---|---|
integer | checksum | The final checksum value, which is greater or equal to 0, and less than 2^16 (0x10000). |
#Fletcher16:reset
function Fletcher16:reset(): Fletcher16
Resets checksum to the initial value.
Returns
| Type | Name | Description |
|---|---|---|
Fletcher16 | self |
#Fletcher16:update
function Fletcher16:update(raw_str: string): Fletcher16
Updates checksum with the specified string.
Parameters
| Name | Type | Description |
|---|---|---|
raw_str | string | The string is used to update checksum. |
Returns
| Type | Name | Description |
|---|---|---|
Fletcher16 | self |