view src/lib/hex-binary.h @ 765:553f050c8313 HEAD

Added buffer API. Point is to hide all buffer writing behind this API which verifies that nothing overflows. Much better than doing the same checks all around the code, even if it is slightly slower. Buffer reading is still mostly done directly, that isn't such a big security risk and I can't think of a reasonable API for it anyway.
author Timo Sirainen <tss@iki.fi>
date Sun, 08 Dec 2002 07:23:07 +0200
parents f3ab97771ed8
children fd8888f6f037
line wrap: on
line source

#ifndef __HEX_BINARY_H
#define __HEX_BINARY_H

/* Convert binary to lowercased hex digits allocating return value from
   data stack */
const char *binary_to_hex(const unsigned char *data, size_t size);

/* Convert hex to binary. data and dest may point to same value.
   Returns TRUE if successful. Returns 1 if all ok, 0 if dest buffer got full
   or -1 if data is invalid. */
int hex_to_binary(const char *data, Buffer *dest);

#endif