From 3ac09d31a308de0a7aa132458940bf5b49aee412 Mon Sep 17 00:00:00 2001 From: Sein Coray Date: Mon, 20 May 2019 22:03:55 +0200 Subject: [PATCH] fixed mingw warnings by making clean hex to binary conversion on hash parsing --- src/modules/module_17200.c | 7 +++---- src/modules/module_17210.c | 7 +++---- src/modules/module_17220.c | 7 +++---- src/modules/module_17230.c | 7 +++---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/modules/module_17200.c b/src/modules/module_17200.c index 7236b14d3..b40ace1e9 100644 --- a/src/modules/module_17200.c +++ b/src/modules/module_17200.c @@ -172,10 +172,9 @@ u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void hex_to_binary (const char *source, int len, char* out) { - const char *pos = source; - for (size_t count = 0; count < (size_t) len/2; count++) { - sscanf(pos, "%2hhx", &out[count]); - pos += 2; + for (int i = 0, j = 0; j < len; i += 1, j += 2) + { + out[i] = hex_to_u8 ((const u8 *) &source[j]); } } diff --git a/src/modules/module_17210.c b/src/modules/module_17210.c index 2e1d90298..8d395a2a1 100644 --- a/src/modules/module_17210.c +++ b/src/modules/module_17210.c @@ -172,10 +172,9 @@ u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void hex_to_binary (const char *source, int len, char* out) { - const char *pos = source; - for (size_t count = 0; count < (size_t) len/2; count++) { - sscanf(pos, "%2hhx", &out[count]); - pos += 2; + for (int i = 0, j = 0; j < len; i += 1, j += 2) + { + out[i] = hex_to_u8 ((const u8 *) &source[j]); } } diff --git a/src/modules/module_17220.c b/src/modules/module_17220.c index 2b6c16bfa..cc3c5a851 100644 --- a/src/modules/module_17220.c +++ b/src/modules/module_17220.c @@ -172,10 +172,9 @@ u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void hex_to_binary (const char *source, int len, char* out) { - const char *pos = source; - for (size_t count = 0; count < (size_t) len/2; count++) { - sscanf(pos, "%2hhx", &out[count]); - pos += 2; + for (int i = 0, j = 0; j < len; i += 1, j += 2) + { + out[i] = hex_to_u8 ((const u8 *) &source[j]); } } diff --git a/src/modules/module_17230.c b/src/modules/module_17230.c index 649996f45..741bb0e5a 100644 --- a/src/modules/module_17230.c +++ b/src/modules/module_17230.c @@ -172,10 +172,9 @@ u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void hex_to_binary (const char *source, int len, char* out) { - const char *pos = source; - for (size_t count = 0; count < (size_t) len/2; count++) { - sscanf(pos, "%2hhx", &out[count]); - pos += 2; + for (int i = 0, j = 0; j < len; i += 1, j += 2) + { + out[i] = hex_to_u8 ((const u8 *) &source[j]); } }