Verify bittorrent .torrent metainfo files.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
592B

  1. #ifndef UTIL_H
  2. #define UTIL_H
  3. /*
  4. * Convert byte to human readable.
  5. * If binary is non-zero, use 1024 as conversation number, or else
  6. * use 1000.
  7. * precision is the precision, or -1 for the default
  8. * Returns the characters written on success, or -1 on error (like out is too small)
  9. */
  10. int util_byte2human(long int bytes, int binary, int precision, char* out, size_t out_len);
  11. /*
  12. * Convert raw bytes in 'bytes' to hex format into out
  13. * out has to be at least bytes_len * 2 + 1 large
  14. */
  15. void util_byte2hex(const unsigned char* bytes, int bytes_len, int uppercase, char* out);
  16. #endif