base16.h 594 B

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