diff options
Diffstat (limited to 'nacl/curvecp/hexparse.c')
-rw-r--r-- | nacl/curvecp/hexparse.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/nacl/curvecp/hexparse.c b/nacl/curvecp/hexparse.c deleted file mode 100644 index 43bfe044..00000000 --- a/nacl/curvecp/hexparse.c +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #include "hexparse.h" | ||
2 | |||
3 | static int hexdigit(char x) | ||
4 | { | ||
5 | if (x >= '0' && x <= '9') return x - '0'; | ||
6 | if (x >= 'a' && x <= 'f') return 10 + (x - 'a'); | ||
7 | if (x >= 'A' && x <= 'F') return 10 + (x - 'A'); | ||
8 | return -1; | ||
9 | } | ||
10 | |||
11 | int hexparse(unsigned char *y,long long len,const char *x) | ||
12 | { | ||
13 | if (!x) return 0; | ||
14 | while (len > 0) { | ||
15 | int digit0; | ||
16 | int digit1; | ||
17 | digit0 = hexdigit(x[0]); if (digit0 == -1) return 0; | ||
18 | digit1 = hexdigit(x[1]); if (digit1 == -1) return 0; | ||
19 | *y++ = digit1 + 16 * digit0; | ||
20 | --len; | ||
21 | x += 2; | ||
22 | } | ||
23 | if (x[0]) return 0; | ||
24 | return 1; | ||
25 | } | ||