blob: cb2e86f27f9a4401ec66e7fd76dc4850cdd91ed9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
#ifndef OT_HEX_H__
#define OT_HEX_H__
#include <stdint.h>
#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);
#endif
|