diff --git a/src/modules/module_17220.c b/src/modules/module_17220.c index f6fe0d12c..989c509ee 100644 --- a/src/modules/module_17220.c +++ b/src/modules/module_17220.c @@ -308,6 +308,10 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE for (int cnt = 0; cnt < pkzip->hash_count; cnt++) { + if (cnt > 0) + { + out_len += sprintf (line_buf + out_len, "*"); + } out_len += sprintf (line_buf + out_len, "%i*%i*", pkzip->hashes[cnt].data_type_enum, pkzip->hashes[cnt].magic_type_enum); if (pkzip->hashes[cnt].data_type_enum > 1) { @@ -320,9 +324,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE out_len += sprintf (line_buf + out_len, "%x*", pkzip->hashes[cnt].checksum_from_timestamp); } - for (u32 i = 0; i < pkzip->hashes[cnt].data_length; i++) + for (u32 i = 0; i < pkzip->hashes[cnt].data_length / 4; i++) { - out_len += sprintf (line_buf + out_len, "%02x", pkzip->hashes[cnt].data[i]); + out_len += sprintf (line_buf + out_len, "%08x", byte_swap_32 (pkzip->hashes[cnt].data[i])); + } + for (u32 i = 0; i < pkzip->hashes[cnt].data_length % 4; i++) + { + out_len += sprintf (line_buf + out_len, "%02x", (pkzip->hashes[cnt].data[pkzip->hashes[cnt].data_length / 4] >> i*8) & 0xff); } } diff --git a/src/modules/module_17230.c b/src/modules/module_17230.c index d9f3ebbfd..41d9270a0 100644 --- a/src/modules/module_17230.c +++ b/src/modules/module_17230.c @@ -309,6 +309,10 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE for (int cnt = 0; cnt < pkzip->hash_count; cnt++) { + if (cnt > 0) + { + out_len += sprintf (line_buf + out_len, "*"); + } out_len += sprintf (line_buf + out_len, "%i*%i*", pkzip->hashes[cnt].data_type_enum, pkzip->hashes[cnt].magic_type_enum); if (pkzip->hashes[cnt].data_type_enum > 1) { @@ -321,9 +325,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE out_len += sprintf (line_buf + out_len, "%x*", pkzip->hashes[cnt].checksum_from_timestamp); } - for (u32 i = 0; i < pkzip->hashes[cnt].data_length; i++) + for (u32 i = 0; i < pkzip->hashes[cnt].data_length / 4; i++) { - out_len += sprintf (line_buf + out_len, "%02x", pkzip->hashes[cnt].data[i]); + out_len += sprintf (line_buf + out_len, "%08x", byte_swap_32 (pkzip->hashes[cnt].data[i])); + } + for (u32 i = 0; i < pkzip->hashes[cnt].data_length % 4; i++) + { + out_len += sprintf (line_buf + out_len, "%02x", (pkzip->hashes[cnt].data[pkzip->hashes[cnt].data_length / 4] >> i*8) & 0xff); } }