summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-11-25 16:16:27 +0100
committeremkael <emkael@tlen.pl>2017-11-25 16:16:27 +0100
commitc05d5976d97869e4a981f3403732bea07985c579 (patch)
treea809d4ac3c3f787c1c79d3d0f30da932be1e03a9
parent3fe24df1237a77549ba64c6331383a9a40aed1de (diff)
Dumping hash input and output to STDERR
-rw-r--r--main.c22
1 files changed, 22 insertions, 0 deletions
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
@@ -633,6 +648,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
*/