libcommonc++
0.7
|
Routines for ASCII hex encoding and decoding. More...
#include <Hex.h++>
Static Public Member Functions | |
static size_t | encode (ByteBuffer &input, CharBuffer &output, bool lowercase=false) |
Hex-encode a buffer of data. More... | |
static size_t | encode (const byte_t *input, size_t inputLen, char *output, size_t outputLen, bool lowercase=false) |
Hex-encode an array of bytes. More... | |
static String | encode (const Blob &input, bool lowercase=false) |
Hex-encode a Blob, returning the result as a String. More... | |
static size_t | decode (CharBuffer &input, ByteBuffer &output) |
Hex-decode a buffer of data. More... | |
static size_t | decode (const char *input, size_t inputLen, byte_t *output, size_t outputLen) |
Hex-decode an array of bytes. More... | |
static Blob | decode (const String &input) |
Hex-decode a String, returning the result as a Blob. More... | |
static char | encodeDigit (uint_t i, bool lowercase=false) |
Encode an integer value (which should be in the range 0 - 15) to a hexadecimal digit. More... | |
static uint_t | decodeDigit (char c) |
Decode a hexadecimal digit (one of the characters '0' - '9', 'A' - 'F', or 'a' - 'f') to an integer value in the range 0 - 15. More... | |
static uint_t | decodeDigit (char16_t c) |
Decode a hexadecimal digit (one of the characters '0' - '9', 'A' - 'F', or 'a' - 'f') to an integer value in the range 0 - 15. More... | |
Routines for ASCII hex encoding and decoding.
Hex encoding consists of encoding each byte as two ASCII characters that represent its value in hexadecimal; for example the value 0x3B would be encoded as the characters "3B".
|
static |
Hex-decode a buffer of data.
If the output buffer is too small, no decoding is done, and the required size of the output buffer is returned.
input | The input buffer. |
output | The output buffer. |
|
static |
Hex-decode an array of bytes.
If the output array is too small, no decoding is done, and the required length of the output array is returned.
input | The input array. |
inputLen | The length of the input array. |
output | The output array. |
outputLen | The length of the output array. |
|
static |
Decode a hexadecimal digit (one of the characters '0' - '9', 'A' - 'F', or 'a' - 'f') to an integer value in the range 0 - 15.
c | The hex digit to decode. |
Decode a hexadecimal digit (one of the characters '0' - '9', 'A' - 'F', or 'a' - 'f') to an integer value in the range 0 - 15.
c | The hex digit to decode. |
|
static |
Hex-encode a buffer of data.
If the output buffer is too small, no encoding is done, and the required size of the output buffer is returned.
input | The input buffer. |
output | The output buffer. |
lowercase | A flag indicating whether lowercase characters should be used for hexadecimal digits ('a' - 'f'). |
|
static |
Hex-encode an array of bytes.
If the output array is too small, no decoding is done, and the required length of the output array is returned.
input | The input array. |
inputLen | The length of the input array. |
output | The output array. |
outputLen | The length of the output array. |
lowercase | A flag indicating whether lowercase characters should be used for hexadecimal digits ('a' - 'f'). |
|
static |
Encode an integer value (which should be in the range 0 - 15) to a hexadecimal digit.
i | The value to encode. |
lowercase | A flag indicating whether the hex digits A - F should be encoded in upper- or lower-case. |