MLIB
Loading...
Searching...
No Matches
hex.h
Go to the documentation of this file.
1/*
2 Copyright (c) Mircea Neacsu (2014-2025) Licensed under MIT License.
3 This is part of MLIB project. See LICENSE file for full license terms.
4*/
5
7#pragma once
8
9namespace mlib {
10
12size_t hexbin (unsigned char* dst, const char* src, size_t sz);
13
15void binhex (char* dst, const unsigned char* src, size_t sz);
16
18void bytehex (char* dst, unsigned char bin);
19
21void shorthex (char* dst, unsigned short bin);
22
24void longhex (char* dst, unsigned long bin);
25
27bool hexbyte (unsigned char& dst, const char* src);
28
30bool hexshort (unsigned short& dst, const char* src);
31
33bool hexlong (unsigned long& dst, const char* src);
34
35} //namespace mlib
36
bool hexbyte(unsigned char &dst, const char *src)
convert two ASCII hex digits to binary
Definition hex.cpp:86
bool hexshort(unsigned short &dst, const char *src)
convert four ASCII hex digits to binary
Definition hex.cpp:120
void bytehex(char *dst, unsigned char bin)
convert one byte to two hex digits
Definition hex.cpp:41
void longhex(char *dst, unsigned long bin)
convert a long integer to 8 hex digits
Definition hex.cpp:71
void binhex(char *dst, const unsigned char *src, size_t sz)
convert binary data to a string of hex digits
Definition hex.cpp:25
void shorthex(char *dst, unsigned short bin)
convert a short integer to 4 hex digits
Definition hex.cpp:58
bool hexlong(unsigned long &dst, const char *src)
convert eight ASCII hex digits to binary
Definition hex.cpp:140
size_t hexbin(unsigned char *dst, const char *src, size_t sz)
convert a string of hex digits to binary
Definition hex.cpp:161