/* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. $id$ */ #ifndef OT_HEX_H__ #define OT_HEX_H__ #include #include "trackerlogic.h" /* Write hash as forty upper case hex digits followed by a terminating zero. dest must have room for forty one bytes. Returns dest. */ char *hex_fromhash(char *dest, const uint8_t *hash); /* Read forty hex digits from src into hash. Returns non-zero on success. On failure hash is left untouched and no byte of src beyond the offending character is read, so src need not be forty characters long. */ int hex_tohash(ot_hash hash, const char *src); /* Non-zero if c is a hexadecimal digit, in either case. */ int hex_isdigit(int c); /* The value of a hexadecimal digit, or -1 if c is not one. Shared with the address scanner so that both agree on what a digit is. */ int hex_value(int c); #endif