Parent topic:MPLAB® Harmony Crypto Library
int CRYPT_HUFFMAN_Compress(
unsigned char* out,
unsigned int outSz,
const unsigned char* in,
unsigned int inSz,
unsigned int flags
);
This function compresses a block of data using Huffman encoding.
None.
Parameters | Description |
---|---|
out | Pointer to location to store the compressed data. |
outSz | Maximum size of the output data in bytes. |
in | Point to location of source data. |
inSz | Size of the input data in bytes. |
flags | Flags to control how compress operates. |
-
negative - Error code.
-
positive - Bytes stored in the out buffer.
Output buffer must be large enough to hold the contents of the operation.
const unsigned char text[] = "...";
unsigned int inSz = sizeof(text);
unsigned int outSz;
unsigned char cBuffer[1024];
int ret;
ret = CRYPT_HUFFMAN_COMPRESS(cBuffer, sizeof(cBuffer), text, inSz, 0);