From c05d5976d97869e4a981f3403732bea07985c579 Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 25 Nov 2017 16:16:27 +0100 Subject: Dumping hash input and output to STDERR --- main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/main.c b/main.c index bd3e299..fe63404 100644 --- a/main.c +++ b/main.c @@ -402,6 +402,21 @@ get_entropy_from_keyboard() { cooked(); } +#ifdef BIGDEALX +char * +hexdump(byte *input, int len) { + int i = 0; + char *output = malloc(2*len+1); + char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + output[len] = 0; + for (i = 0; i < len; i++) { + output[2*i] = hex[input[i] >> 4]; + output[2*i+1] = hex[input[i] & 0x0F]; + } + return output; +} +#endif + /* * Structure with all values that get hashed for random generation * This includes hash of owner identication making it impossible for @@ -632,6 +647,13 @@ main (int argc, char *argv[]) */ memcpy(dnumber.dn_num, hashcode, L); } while(!goedel(&dnumber)); + /* + * Dump the input and the output to STDERR + * Probably should have been done on some command line switch + */ +#ifdef BIGDEALX + fprintf(stderr, "%s %s\n", hexdump((byte *) &seed, sizeof(seed)), hexdump((byte *) hashcode, RMDbytes)); +#endif /* * Ok, got one * Print it in all desired formats -- cgit v1.2.3