summaryrefslogtreecommitdiff
path: root/src/ot_hex.h
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-02 20:50:24 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-02 21:14:02 +0100
commitad541c67761b8aa6da1566802c347cac4018d0c2 (patch)
treea9166fa9d349911d69a6948e53b05344dcc348a0 /src/ot_hex.h
parentc679ff8a3b1418a5960cc49ba6458a0007df54fa (diff)
Move the build sources into src/
Diffstat (limited to 'src/ot_hex.h')
-rw-r--r--src/ot_hex.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ot_hex.h b/src/ot_hex.h
new file mode 100644
index 0000000..ddbbb44
--- /dev/null
+++ b/src/ot_hex.h
@@ -0,0 +1,27 @@
1/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
2 It is considered beerware. Prost. Skol. Cheers or whatever. */
3
4#ifndef OT_HEX_H__
5#define OT_HEX_H__
6
7#include <stdint.h>
8
9#include "trackerlogic.h"
10
11/* Write hash as forty upper case hex digits followed by a terminating zero.
12 dest must have room for forty one bytes. Returns dest. */
13char *hex_from_hash(char *dest, const uint8_t *hash);
14
15/* Read forty hex digits from src into hash. Returns non-zero on success.
16 On failure hash is left untouched and no byte of src beyond the offending
17 character is read, so src need not be forty characters long. */
18int hex_to_hash(ot_hash hash, const char *src);
19
20/* Non-zero if c is a hexadecimal digit, in either case. */
21int hex_isdigit(int c);
22
23/* The value of a hexadecimal digit, or -1 if c is not one. Shared with the
24 address scanner so that both agree on what a digit is. */
25int hex_value(int c);
26
27#endif