Saphe Implementation - hexlify.h
/**
 * 
 * Binary/Hex conversions
 *
 * Copyright (C) 2007-2008
 * Uri Sternfeld (saphesolution@yahoo.com)
 * All Rights Reserved
 *
 * Written by Uri Sternfeld
 * Last modified: 30/12/2007
 *
 **/
 
#ifndef __HEXLIFY_H__
#define __HEXLIFY_H__
 
#include "defs.h"
 
/**
 * Convert a binary array to a hex string.
 * out size MUST be at least ((size*2)+1).
 *
 * Input:
 *    in - byte array to convert to a hex-string
 *    size - the length (in bytes) of 'in'
 * Output:
 *    out - the output char string
 * Returns:
 *    nothing
 **/
void Hexlify(const byte* in, unsigned int size, char* out);
 
/**
 * Convert a hex string to a binary array, if possible.
 * Returns false for any error.
 * out size MUST be at least (size/2).
 *
 * Input:
 *    in - characters string to convert to binary
 *    size - the length (in characters, not including null-terminator) of 'in'
 * Output:
 *    out - the output bytes array
 * Returns:
 *    true if successful
 *    false if 'in' is an illegal hex string
 **/
bool Unhexlify(const char* in, unsigned int size, byte* out);
 
#endif

Back to Saphe implementation page

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License