Module liba.crc8
8-bit Cyclic Redundancy Check
Functions
new (poly, reversed) | constructor for 8-bit Cyclic Redundancy Check |
gen (ctx, poly, reversed) | generate for 8-bit Cyclic Redundancy Check |
eval (ctx, block, value) | calculate for 8-bit Cyclic Redundancy Check |
pack (ctx, block, value) | pack a block and its 8-bit Cyclic Redundancy Check value |
Functions
- new (poly, reversed)
-
constructor for 8-bit Cyclic Redundancy Check
Parameters:
- poly integer polynomial that is CRC's divisor
- reversed boolean whether or not to reverse
Returns:
-
a.crc8
8-bit Cyclic Redundancy Check userdata
- gen (ctx, poly, reversed)
-
generate for 8-bit Cyclic Redundancy Check
Parameters:
- ctx a.crc8 8-bit Cyclic Redundancy Check userdata
- poly integer polynomial that is CRC's divisor
- reversed boolean whether or not to reverse
Returns:
-
a.crc8
8-bit Cyclic Redundancy Check userdata
- eval (ctx, block, value)
-
calculate for 8-bit Cyclic Redundancy Check
Parameters:
- ctx a.crc8 8-bit Cyclic Redundancy Check userdata
- block string block to be processed
- value integer initial value
Returns:
-
integer
output value
- pack (ctx, block, value)
-
pack a block and its 8-bit Cyclic Redundancy Check value
Parameters:
- ctx a.crc8 8-bit Cyclic Redundancy Check userdata
- block string block to be processed
- value integer initial value
Returns:
-
string
packed block