improvements all over the place

This commit is contained in:
cathugger
2017-09-25 20:49:47 +03:00
parent 59c07f0fdf
commit 7887d086f2
7 changed files with 250 additions and 70 deletions

View File

@@ -1,3 +1,11 @@
char *base16_to(char *dst, const u8 *src, size_t slen);
size_t base16_from(u8 *dst, u8 *dmask, const char *src);
// converts src[0:slen] to base16 string
char *base16_to(char *dst,const u8 *src,size_t slen);
// calculates length needed to store data converted to base16
#define BASE16_TO_LEN(l) (((l) * 8 + 3) / 4)
// converts src string from base16
size_t base16_from(u8 *dst,u8 *dmask,const char *src);
// calculates length needed to store data converted from base16
#define BASE16_FROM_LEN(l) (((l) * 4 + 7) / 8)
// validates base16 string and optionally stores length of valid data
// returns 1 if whole string is good, 0 if string contains invalid data
int base16_valid(const char *src,size_t *count);