#ifndef UTIL_H_
#define UTIL_H_

#include <stdint.h>

#define MAXLEN_FILE     1000000
#define MAXLEN_POST     4096
#define MAXLEN_REQUEST  256
#define MAXLEN_HEADER   512
#define MAXLEN_SQL      512
#define MAXLEN_LOG      320
#define MAXLEN_PATH     128
#define MAXLEN_KEY      32

#define b64max(i) ((4*(i/3))+4)
#define min(a, b) (a < b) ? a : b
#define max(a, b) (a > b) ? b : a

typedef unsigned char uint8_t;

char* read_file(char* path, size_t sz, size_t nmemb);
void logs(char* msg, ...);
void sha512_hash(const uint8_t *message, uint32_t len, uint64_t hash[8]); //Project Nayuki hash function
void b64encode(char* input, char* output, size_t sz);
void b64decode(char* input, char* output, size_t sz);
#endif
