This function converts a hexadecimal character string into a buffer of binary data.
The hexadecimal encoding scheme is typically used to convert a binary blob into a character string for some type of storage or network transfer. This function undoes the encoding. This function does not handle any line termination characters in the pHex input parameter.
The parameter pDecoded can be set to NULL. In this case, this function returns the buffer size required to perform the decode operation in the pWritten parameter.
- Parameters
-
pHex | [ in ] Pointer to a buffer containing hexadecimal encoded data |
pDecoded | [ out ] The data pointed to by pHex decoded into its orginal form. This pointer can be NULL. |
cBuffer | [ in ] Number of bytes in the buffer pointed to by pDecoded. |
pWritten | [ out ] Optional can be NULL, returns the number of bytes written into pDecoded. This parameter cannot be NULL when pDecoded is also NULL. |
- Returns
Success | P6R::eOk | |
Failure | P6R::eInvalidArg | pHex is NULL or cBuffer is zero. Or both pHex and pWritten are NULL. |
P6R::eTooSmall | The buffer pDecoded is too small to contain the generated value. |
P6R::eNotInitialized | A successful call to initialize has not been done. |
P6R::eFormatError | The data pointed to by pHex is not proper hexadecimal (e.g., invalid character or of wrong length). |