util.h 717 B

123456789101112131415161718192021222324252627
  1. #ifndef UTIL_H_
  2. #define UTIL_H_
  3. #include <stdint.h>
  4. #define MAXLEN_FILE 1000000
  5. #define MAXLEN_POST 4096
  6. #define MAXLEN_REQUEST 256
  7. #define MAXLEN_HEADER 512
  8. #define MAXLEN_SQL 512
  9. #define MAXLEN_LOG 320
  10. #define MAXLEN_PATH 128
  11. #define MAXLEN_KEY 32
  12. #define b64max(i) ((4*(i/3))+4)
  13. #define min(a, b) (a < b) ? a : b
  14. #define max(a, b) (a > b) ? b : a
  15. typedef unsigned char uint8_t;
  16. char* read_file(char* path, size_t sz, size_t nmemb);
  17. void logs(char* msg, ...);
  18. void sha512_hash(const uint8_t *message, uint32_t len, uint64_t hash[8]); //Project Nayuki hash function
  19. void b64encode(char* input, char* output, size_t sz);
  20. void b64decode(char* input, char* output, size_t sz);
  21. #endif