23#define BCRYPT_HASH_MAXSIZE 65
25extern unsigned char st_app_terminate;
27unsigned char st_file_exists(
const char *fp);
28void st_hook_signals(
void);
29void st_hook_critical_signals(
void);
30char st_try_fork(
void);
31char st_set_ug_id(
const char *username,
int uid,
int gid);
32char st_setpidfile(
char *pidfile_path);
33void st_delpidfile(
char *pidfile_path);
34void st_mainloop_init();
35void st_mainloop_wait(
int usec);
36void st_mainloop_free();
38void st_guid2hex(
char GUIDHEX[SUPLA_GUID_HEXSIZE],
39 const char GUID[SUPLA_GUID_SIZE]);
40void st_authkey2hex(
char AuthKeyHEX[SUPLA_AUTHKEY_HEXSIZE],
41 const char AuthKey[SUPLA_AUTHKEY_SIZE]);
43char *st_str2hex(
char *buffer,
const char *str,
size_t maxlen);
44char *st_bin2hex(
char *buffer,
const char *src,
size_t len);
46char st_read_randkey_from_file(
char *file,
char *KEY,
int size,
char create);
47char st_read_guid_from_file(
char *file,
char *GUID,
char create);
48char st_read_authkey_from_file(
char *file,
char *AuthKey,
char create);
50time_t st_get_utc_time(
void);
52char *st_get_zulu_time(
char buffer[64]);
53char *st_get_datetime_str(
char buffer[64]);
57int st_hue2rgb(
double hue);
59void st_random_alpha_string(
char *buffer,
int buffer_size);
60void st_uuid_v4(
char buffer[37]);
64char st_bcrypt_gensalt(
char *salt,
int salt_buffer_size,
char rounds);
65char st_bcrypt_hash(
const char *str,
const char *salt,
char *hash,
66 int hash_buffer_size);
67char st_bcrypt_crypt(
char *str,
char *hash,
int hash_buffer_size,
char rounds);
68char st_bcrypt_check(
const char *str,
char *hash,
int hash_len);
69char *st_get_authkey_hash_hex(
const char AuthKey[SUPLA_AUTHKEY_SIZE]);
70int format_decimal_trunc(
double x,
int precision,
int scale,
char *out,
74unsigned _supla_int_t st_crc32_checksum(
const unsigned char *data,
78char *st_openssl_base64_encode(
const char *src,
int src_len);
79char *st_openssl_base64_decode(
const char *src,
int src_len,
int *dst_len);