Skip to content

Latest commit

 

History

History
58 lines (38 loc) · 1.08 KB

GUID-BCF95DBA-6C94-4195-A199-599A8ED93B3D.md

File metadata and controls

58 lines (38 loc) · 1.08 KB

CRYPT_HUFFMAN_Compress Function

Parent topic:MPLAB® Harmony Crypto Library

C

int CRYPT_HUFFMAN_Compress(
    unsigned char* out, 
    unsigned int outSz, 
    const unsigned char* in, 
    unsigned int inSz, 
    unsigned int flags
);

Description

This function compresses a block of data using Huffman encoding.

Preconditions

None.

Parameters

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.

Returns

  • negative - Error code.

  • positive - Bytes stored in the out buffer.

Remarks

Output buffer must be large enough to hold the contents of the operation.

Example

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);