blob: 28eddf5addfbf75809ec69118707b8cfc02c9970 (
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
26
27
28
29
|
/* 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_from_hash(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_to_hash(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
|