diff options
author | Konstantin Kowalski <kostyakow42@gmail.com> | 2013-07-27 12:10:41 -0400 |
---|---|---|
committer | Konstantin Kowalski <kostyakow42@gmail.com> | 2013-07-27 12:10:41 -0400 |
commit | b3fa1fc8f48aea08da1552d76397e959cd0aa690 (patch) | |
tree | 53511a8fffa0c019b7bb6d92815cca2cd5969a6b /testing/DHT_cryptosendfiletest.c | |
parent | 4edf2207fe1fe41e5ad6a17067eb91bd9fdbaef9 (diff) |
[fixed]created new files misc_tools.(c|h) and moved hex_string_to_bin() there.
Diffstat (limited to 'testing/DHT_cryptosendfiletest.c')
-rw-r--r-- | testing/DHT_cryptosendfiletest.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/testing/DHT_cryptosendfiletest.c b/testing/DHT_cryptosendfiletest.c index 5c3a0256..c7c33531 100644 --- a/testing/DHT_cryptosendfiletest.c +++ b/testing/DHT_cryptosendfiletest.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "../core/network.h" | 38 | #include "../core/network.h" |
39 | #include "../core/DHT.h" | 39 | #include "../core/DHT.h" |
40 | #include "../core/net_crypto.h" | 40 | #include "../core/net_crypto.h" |
41 | #include "misc_tools.h" | ||
41 | 42 | ||
42 | #include <string.h> | 43 | #include <string.h> |
43 | 44 | ||
@@ -60,22 +61,6 @@ void printip(IP_Port ip_port) | |||
60 | printf("\nIP: %u.%u.%u.%u Port: %u\n",ip_port.ip.c[0],ip_port.ip.c[1],ip_port.ip.c[2],ip_port.ip.c[3],ntohs(ip_port.port)); | 61 | printf("\nIP: %u.%u.%u.%u Port: %u\n",ip_port.ip.c[0],ip_port.ip.c[1],ip_port.ip.c[2],ip_port.ip.c[3],ntohs(ip_port.port)); |
61 | } | 62 | } |
62 | 63 | ||
63 | //TODO: rewrite | ||
64 | unsigned char * hex_string_to_bin(char hex_string[]) | ||
65 | { | ||
66 | size_t len = strlen(hex_string); | ||
67 | unsigned char * val = malloc(len); | ||
68 | char * pos = hex_string; | ||
69 | int i=0; | ||
70 | while(i < len) | ||
71 | { | ||
72 | sscanf(pos,"%2hhx",&val[i]); | ||
73 | pos+=2; | ||
74 | i++; | ||
75 | } | ||
76 | return val; | ||
77 | } | ||
78 | |||
79 | uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; | 64 | uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; |
80 | 65 | ||
81 | int main(int argc, char *argv[]) | 66 | int main(int argc, char *argv[]) |