hex.h 791 B

12345678910111213141516171819202122232425
  1. /* hex.h - conversion for hexadecimal and base32 strings. */
  2. #ifndef HEX_H
  3. #define HEX_H
  4. #include "ustd.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. void rhash_byte_to_hex(char *dest, const unsigned char *src, unsigned len, int upper_case);
  9. void rhash_byte_to_base32(char* dest, const unsigned char* src, unsigned len, int upper_case);
  10. void rhash_byte_to_base64(char* dest, const unsigned char* src, unsigned len);
  11. char* rhash_print_hex_byte(char *dest, const unsigned char byte, int upper_case);
  12. int rhash_urlencode(char *dst, const char *name);
  13. int rhash_sprintI64(char *dst, uint64_t number);
  14. #define BASE32_LENGTH(bytes) (((bytes) * 8 + 4) / 5)
  15. #define BASE64_LENGTH(bytes) ((((bytes) + 2) / 3) * 4)
  16. #ifdef __cplusplus
  17. } /* extern "C" */
  18. #endif /* __cplusplus */
  19. #endif /* HEX_H */