Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Utilities/cmlibrhash/librhash/hex.h
3150 views
1
/* hex.h - conversion for hexadecimal and base32 strings. */
2
#ifndef HEX_H
3
#define HEX_H
4
5
#include "ustd.h"
6
7
#ifdef __cplusplus
8
extern "C" {
9
#endif
10
11
void rhash_byte_to_hex(char* dest, const unsigned char* src, size_t length, int upper_case);
12
void rhash_byte_to_base32(char* dest, const unsigned char* src, size_t length, int upper_case);
13
void rhash_byte_to_base64(char* dest, const unsigned char* src, size_t length);
14
char* rhash_print_hex_byte(char* dest, const unsigned char byte, int upper_case);
15
size_t rhash_urlencode(char* dst, const char* str, size_t size, int upper_case);
16
size_t rhash_base64_url_encoded_helper(char* dst, const unsigned char* src, size_t length, int url_encode, int upper_case);
17
int rhash_sprintI64(char* dst, uint64_t number);
18
19
#define BASE32_LENGTH(bytes) (((bytes) * 8 + 4) / 5)
20
#define BASE64_LENGTH(bytes) ((((bytes) + 2) / 3) * 4)
21
22
#ifdef __cplusplus
23
} /* extern "C" */
24
#endif /* __cplusplus */
25
26
#endif /* HEX_H */
27
28