WvStreams
Classes | Functions
wvhex.h File Reference
#include "wvencoder.h"
Include dependency graph for wvhex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  WvHexEncoder
 A hex encoder. More...
 
class  WvHexDecoder
 A hex decoder. More...
 

Functions

void hexify (char *obuf, const void *ibuf, size_t len)
 Write the contents of the binary string of length 'len' pointed to by 'ibuf' into the output buffer 'obuf' in hexadecimal format. More...
 
void unhexify (void *obuf, const char *ibuf)
 Reverse the operation performed by hexify(). More...
 

Detailed Description

Hex functions for compatibility with older code

Definition in file wvhex.h.

Function Documentation

◆ hexify()

void hexify ( char *  obuf,
const void *  ibuf,
size_t  len 
)

Write the contents of the binary string of length 'len' pointed to by 'ibuf' into the output buffer 'obuf' in hexadecimal format.

For example, if len==4, ibuf=="ABCDEF", then obuf will contain "41424344" with a terminating NULL character.

This is useful to turn arbitrary binary into a simple printable format, so that it can (for example) be written to a WvConf configuration file.

obuf must be a buffer with at least (len * 2) + 1 bytes available. (two digits for each byte of ibuf, plus a terminating NULL).

Definition at line 95 of file wvhex.cc.

◆ unhexify()

void unhexify ( void *  obuf,
const char *  ibuf 
)

Reverse the operation performed by hexify().

obuf must be a buffer large enough to contain the entire binary output string; you can calculate this size with (strlen(ibuf) / 2). obuf will NOT be automatically NULL-terminated.

Definition at line 104 of file wvhex.cc.

References WvEncoder::flushmemmem().

Referenced by WvX509::decode().