1.2 CRYPT_HUFFMAN_Compress Function

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

ParametersDescription
outPointer to location to store the compressed data
outSzMaximum size of the output data in bytes
inPoint to location of source data
inSzSize of the input data in bytes
flagsFlags 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);