checksum.CRC8
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.CRC8Fields
| Name | Type | Description |
|---|---|---|
DigestSize | integer | The size of the checksum in bytes. = 1 |
Static functions
CDMA2000 | The CRC-8 checksum class that uses CDMA2000 algorithm parameters. |
digest | Calculates the CRC-8 checksum of the specified string. |
MAXIM | The CRC-8 checksum class that uses MAXIM algorithm parameters. |
ROHC | The CRC-8 checksum class that uses ROHC algorithm parameters. |
#CRC8.CDMA2000
function CRC8.CDMA2000(): checksum.CRC8
The CRC-8 checksum class that uses CDMA2000 algorithm parameters.
Returns
| Type | Name | Description |
|---|---|---|
checksum.CRC8 | object |
#CRC8.digest
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
| Name | Type | Description |
|---|---|---|
raw_str | string | The string is used to calculate checksum. |
polyoptional | integer | The polynomial is used to calculate checksum. |
initoptional | integer | The initial value of checksum. |
ref_inoptional | boolean | true if input checksum is reversed, otherwise false. |
ref_outoptional | boolean | true if output checksum is reversed, otherwise false. |
xor_outoptional | integer | The value to be XORed with output checksum. |
Returns
| Type | Name | Description |
|---|---|---|
integer | checksum | The CRC-8 checksum, which is greater or equal to 0, and less than 2^8 (0x100). |
#CRC8.MAXIM
function CRC8.MAXIM(): checksum.CRC8
The CRC-8 checksum class that uses MAXIM algorithm parameters.
Returns
| Type | Name | Description |
|---|---|---|
checksum.CRC8 | object |
#CRC8.ROHC
function CRC8.ROHC(): checksum.CRC8
The CRC-8 checksum class that uses ROHC algorithm parameters.
Returns
| Type | Name | Description |
|---|---|---|
checksum.CRC8 | object |
Methods
digest | Finalizes checksum calculation and returns the resulting checksum. |
reset | Resets checksum to the initial value. |
update | Updates checksum with the specified string. |
#CRC8:digest
function checksum.CRC8: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^8 (0x100). |
#CRC8:reset
function checksum.CRC8:reset(): checksum.CRC8
Resets checksum to the initial value.
Returns
| Type | Name | Description |
|---|---|---|
checksum.CRC8 | self |
#CRC8:update
function checksum.CRC8:update(raw_str: string): checksum.CRC8
Updates checksum with the specified string.
Parameters
| Name | Type | Description |
|---|---|---|
raw_str | string | The string is used to update checksum. |
Returns
| Type | Name | Description |
|---|---|---|
checksum.CRC8 | self |