4

I am attempting to implement an algorithm for calculating LZ77 on a byte array, MIME Base64 encoding on the outputted byte array, and then a CRC-16 on the outputted byte array from the MIM Base64 encoding. This will be done in order to compress and encode PNG images for printing to ZPL.

The CRC-16 follows the logic below:

CRC: A four digit CRC value in hexadecimal. If 0000 is entered, then the CRC validation is ignored. For examples, see below.

CRC example The value of the field is calculated the CRC-16 for the contents of a specified file using the CRC16-CCITT polynomial which is x^16 + x^12 + x^5 + 1. It is calculated using an initial CRC of 0x0000.

checksum example Given 4 bytes of data : 0x25, 0x62, 0x3F, 0x52: 1. Adding all bytes together gives 0x118. 2. Drop the carry nibble to get 0x18. 3. Get the two's complement of the 0x18 to get 0xE8. This is the checksum byte.

I am fully aware of the previous StackOverflow discussion at the link below, but it doesn't seem to fully answer the question.

I'm alright with stitching together various items, but I don't think I can abide with porting code from JavaScript to C#.

Printing PNG images to a zebra network printer

0 Answers0