From 1fc22dba03c0e2579eb2f5ce4b8758083f03a019 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 7 Sep 2016 21:13:53 +0200 Subject: [PATCH] Move bitmap specific functions into their own source file --- include/bitmap.h | 25 +++++++++++++++++++++ include/shared.h | 1 - include/types.h | 7 ------ src/Makefile | 10 ++++----- src/bitmap.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ src/hashcat.c | 57 +++++------------------------------------------- src/shared.c | 7 ------ 7 files changed, 92 insertions(+), 72 deletions(-) create mode 100644 include/bitmap.h create mode 100644 src/bitmap.c diff --git a/include/bitmap.h b/include/bitmap.h new file mode 100644 index 000000000..c3937476a --- /dev/null +++ b/include/bitmap.h @@ -0,0 +1,25 @@ +/** + * Author......: Jens Steube + * License.....: MIT + */ + +#ifndef _BITMAP_H +#define _BITMAP_H + +#include + +#define BITMAP_MIN 16 +#define BITMAP_MAX 24 + +typedef struct +{ + uint bitmap_shift; + uint collisions; + +} bitmap_result_t; + +int sort_by_bitmap (const void *s1, const void *s2); + +uint generate_bitmaps (const uint digests_cnt, const uint dgst_size, const uint dgst_shifts, char *digests_buf_ptr, const uint dgst_pos0, const uint dgst_pos1, const uint dgst_pos2, const uint dgst_pos3, const uint bitmap_mask, const uint bitmap_size, uint *bitmap_a, uint *bitmap_b, uint *bitmap_c, uint *bitmap_d, const u64 collisions_max); + +#endif // _BITMAP_H diff --git a/include/shared.h b/include/shared.h index e4f95d3d1..5e5553574 100644 --- a/include/shared.h +++ b/include/shared.h @@ -86,7 +86,6 @@ int sort_by_cpu_rule (const void *p1, const void *p2); int sort_by_kernel_rule (const void *p1, const void *p2); int sort_by_stringptr (const void *p1, const void *p2); int sort_by_dictstat (const void *s1, const void *s2); -int sort_by_bitmap (const void *s1, const void *s2); int sort_by_pot (const void *v1, const void *v2); int sort_by_hash (const void *v1, const void *v2); diff --git a/include/types.h b/include/types.h index 9bb0f83fe..b942b8c01 100644 --- a/include/types.h +++ b/include/types.h @@ -286,13 +286,6 @@ typedef struct } wl_data_t; -typedef struct -{ - uint bitmap_shift; - uint collisions; - -} bitmap_result_t; - #define CPT_BUF 0x20000 typedef struct diff --git a/src/Makefile b/src/Makefile index c69ca7722..23b761608 100644 --- a/src/Makefile +++ b/src/Makefile @@ -166,7 +166,7 @@ LFLAGS_CROSS_WIN := -lpsapi ## Objects ## -NATIVE_OBJS := obj/opencl.NATIVE.o obj/affinity.NATIVE.o obj/filehandling.NATIVE.o obj/tuningdb.NATIVE.o obj/locking.NATIVE.o obj/folder.NATIVE.o obj/bitops.NATIVE.o obj/convert.NATIVE.o obj/cpu_aes.NATIVE.o obj/cpu_crc32.NATIVE.o obj/cpu_des.NATIVE.o obj/cpu_md5.NATIVE.o obj/cpu_sha1.NATIVE.o obj/cpu_sha256.NATIVE.o obj/data.NATIVE.o obj/ext_OpenCL.NATIVE.o obj/hwmon.NATIVE.o obj/interface.NATIVE.o obj/logfile.NATIVE.o obj/logging.NATIVE.o obj/memory.NATIVE.o obj/mpsp.NATIVE.o obj/rp_cpu.NATIVE.o obj/rp_kernel_on_cpu.NATIVE.o obj/shared.NATIVE.o obj/terminal.NATIVE.o obj/usage.NATIVE.o +NATIVE_OBJS := obj/bitmap.NATIVE.o obj/opencl.NATIVE.o obj/affinity.NATIVE.o obj/filehandling.NATIVE.o obj/tuningdb.NATIVE.o obj/locking.NATIVE.o obj/folder.NATIVE.o obj/bitops.NATIVE.o obj/convert.NATIVE.o obj/cpu_aes.NATIVE.o obj/cpu_crc32.NATIVE.o obj/cpu_des.NATIVE.o obj/cpu_md5.NATIVE.o obj/cpu_sha1.NATIVE.o obj/cpu_sha256.NATIVE.o obj/data.NATIVE.o obj/ext_OpenCL.NATIVE.o obj/hwmon.NATIVE.o obj/interface.NATIVE.o obj/logfile.NATIVE.o obj/logging.NATIVE.o obj/memory.NATIVE.o obj/mpsp.NATIVE.o obj/rp_cpu.NATIVE.o obj/rp_kernel_on_cpu.NATIVE.o obj/shared.NATIVE.o obj/terminal.NATIVE.o obj/usage.NATIVE.o ifeq ($(UNAME),Linux) NATIVE_OBJS += obj/ext_ADL.NATIVE.o @@ -175,8 +175,8 @@ NATIVE_OBJS += obj/ext_nvml.NATIVE.o NATIVE_OBJS += obj/ext_xnvctrl.NATIVE.o endif -LINUX_32_OBJS := obj/opencl.LINUX.32.o obj/affinity.LINUX.32.o obj/filehandling.LINUX.32.o obj/tuningdb.LINUX.32.o obj/locking.LINUX.32.o obj/folder.LINUX.32.o obj/bitops.LINUX.32.o obj/convert.LINUX.32.o obj/cpu_aes.LINUX.32.o obj/cpu_crc32.LINUX.32.o obj/cpu_des.LINUX.32.o obj/cpu_md5.LINUX.32.o obj/cpu_sha1.LINUX.32.o obj/cpu_sha256.LINUX.32.o obj/data.LINUX.32.o obj/ext_ADL.LINUX.32.o obj/ext_nvapi.LINUX.32.o obj/ext_nvml.LINUX.32.o obj/ext_OpenCL.LINUX.32.o obj/ext_xnvctrl.LINUX.32.o obj/hwmon.LINUX.32.o obj/interface.LINUX.32.o obj/logfile.LINUX.32.o obj/logging.LINUX.32.o obj/memory.LINUX.32.o obj/mpsp.LINUX.32.o obj/rp_cpu.LINUX.32.o obj/rp_kernel_on_cpu.LINUX.32.o obj/shared.LINUX.32.o obj/terminal.LINUX.32.o obj/usage.LINUX.32.o -LINUX_64_OBJS := obj/opencl.LINUX.64.o obj/affinity.LINUX.64.o obj/filehandling.LINUX.64.o obj/tuningdb.LINUX.64.o obj/locking.LINUX.64.o obj/folder.LINUX.64.o obj/bitops.LINUX.64.o obj/convert.LINUX.64.o obj/cpu_aes.LINUX.64.o obj/cpu_crc32.LINUX.64.o obj/cpu_des.LINUX.64.o obj/cpu_md5.LINUX.64.o obj/cpu_sha1.LINUX.64.o obj/cpu_sha256.LINUX.64.o obj/data.LINUX.64.o obj/ext_ADL.LINUX.64.o obj/ext_nvapi.LINUX.64.o obj/ext_nvml.LINUX.64.o obj/ext_OpenCL.LINUX.64.o obj/ext_xnvctrl.LINUX.64.o obj/hwmon.LINUX.64.o obj/interface.LINUX.64.o obj/logfile.LINUX.64.o obj/logging.LINUX.64.o obj/memory.LINUX.64.o obj/mpsp.LINUX.64.o obj/rp_cpu.LINUX.64.o obj/rp_kernel_on_cpu.LINUX.64.o obj/shared.LINUX.64.o obj/terminal.LINUX.64.o obj/usage.LINUX.64.o +LINUX_32_OBJS := obj/bitmap.LINUX.32.o obj/opencl.LINUX.32.o obj/affinity.LINUX.32.o obj/filehandling.LINUX.32.o obj/tuningdb.LINUX.32.o obj/locking.LINUX.32.o obj/folder.LINUX.32.o obj/bitops.LINUX.32.o obj/convert.LINUX.32.o obj/cpu_aes.LINUX.32.o obj/cpu_crc32.LINUX.32.o obj/cpu_des.LINUX.32.o obj/cpu_md5.LINUX.32.o obj/cpu_sha1.LINUX.32.o obj/cpu_sha256.LINUX.32.o obj/data.LINUX.32.o obj/ext_ADL.LINUX.32.o obj/ext_nvapi.LINUX.32.o obj/ext_nvml.LINUX.32.o obj/ext_OpenCL.LINUX.32.o obj/ext_xnvctrl.LINUX.32.o obj/hwmon.LINUX.32.o obj/interface.LINUX.32.o obj/logfile.LINUX.32.o obj/logging.LINUX.32.o obj/memory.LINUX.32.o obj/mpsp.LINUX.32.o obj/rp_cpu.LINUX.32.o obj/rp_kernel_on_cpu.LINUX.32.o obj/shared.LINUX.32.o obj/terminal.LINUX.32.o obj/usage.LINUX.32.o +LINUX_64_OBJS := obj/bitmap.LINUX.64.o obj/opencl.LINUX.64.o obj/affinity.LINUX.64.o obj/filehandling.LINUX.64.o obj/tuningdb.LINUX.64.o obj/locking.LINUX.64.o obj/folder.LINUX.64.o obj/bitops.LINUX.64.o obj/convert.LINUX.64.o obj/cpu_aes.LINUX.64.o obj/cpu_crc32.LINUX.64.o obj/cpu_des.LINUX.64.o obj/cpu_md5.LINUX.64.o obj/cpu_sha1.LINUX.64.o obj/cpu_sha256.LINUX.64.o obj/data.LINUX.64.o obj/ext_ADL.LINUX.64.o obj/ext_nvapi.LINUX.64.o obj/ext_nvml.LINUX.64.o obj/ext_OpenCL.LINUX.64.o obj/ext_xnvctrl.LINUX.64.o obj/hwmon.LINUX.64.o obj/interface.LINUX.64.o obj/logfile.LINUX.64.o obj/logging.LINUX.64.o obj/memory.LINUX.64.o obj/mpsp.LINUX.64.o obj/rp_cpu.LINUX.64.o obj/rp_kernel_on_cpu.LINUX.64.o obj/shared.LINUX.64.o obj/terminal.LINUX.64.o obj/usage.LINUX.64.o # Windows CRT file globbing: @@ -186,8 +186,8 @@ CRT_GLOB_INCLUDE_FOLDER := $(dir $(lastword $(MAKEFILE_LIST))) include $(CRT_GLOB_INCLUDE_FOLDER)/win_file_globbing.mk -WIN_32_OBJS := obj/opencl.WIN.32.o obj/affinity.WIN.32.o obj/filehandling.WIN.32.o obj/tuningdb.WIN.32.o obj/locking.WIN.32.o obj/folder.WIN.32.o obj/bitops.WIN.32.o obj/convert.WIN.32.o obj/cpu_aes.WIN.32.o obj/cpu_crc32.WIN.32.o obj/cpu_des.WIN.32.o obj/cpu_md5.WIN.32.o obj/cpu_sha1.WIN.32.o obj/cpu_sha256.WIN.32.o obj/data.WIN.32.o obj/ext_ADL.WIN.32.o obj/ext_nvapi.WIN.32.o obj/ext_nvml.WIN.32.o obj/ext_OpenCL.WIN.32.o obj/ext_xnvctrl.WIN.32.o obj/hwmon.WIN.32.o obj/interface.WIN.32.o obj/logfile.WIN.32.o obj/logging.WIN.32.o obj/memory.WIN.32.o obj/mpsp.WIN.32.o obj/rp_cpu.WIN.32.o obj/rp_kernel_on_cpu.WIN.32.o obj/shared.WIN.32.o obj/terminal.WIN.32.o obj/usage.WIN.32.o $(CRT_GLOB_32) -WIN_64_OBJS := obj/opencl.WIN.64.o obj/affinity.WIN.64.o obj/filehandling.WIN.64.o obj/tuningdb.WIN.64.o obj/locking.WIN.64.o obj/folder.WIN.64.o obj/bitops.WIN.64.o obj/convert.WIN.64.o obj/cpu_aes.WIN.64.o obj/cpu_crc32.WIN.64.o obj/cpu_des.WIN.64.o obj/cpu_md5.WIN.64.o obj/cpu_sha1.WIN.64.o obj/cpu_sha256.WIN.64.o obj/data.WIN.64.o obj/ext_ADL.WIN.64.o obj/ext_nvapi.WIN.64.o obj/ext_nvml.WIN.64.o obj/ext_OpenCL.WIN.64.o obj/ext_xnvctrl.WIN.64.o obj/hwmon.WIN.64.o obj/interface.WIN.64.o obj/logfile.WIN.64.o obj/logging.WIN.64.o obj/memory.WIN.64.o obj/mpsp.WIN.64.o obj/rp_cpu.WIN.64.o obj/rp_kernel_on_cpu.WIN.64.o obj/shared.WIN.64.o obj/terminal.WIN.64.o obj/usage.WIN.64.o $(CRT_GLOB_64) +WIN_32_OBJS := obj/bitmap.WIN.32.o obj/opencl.WIN.32.o obj/affinity.WIN.32.o obj/filehandling.WIN.32.o obj/tuningdb.WIN.32.o obj/locking.WIN.32.o obj/folder.WIN.32.o obj/bitops.WIN.32.o obj/convert.WIN.32.o obj/cpu_aes.WIN.32.o obj/cpu_crc32.WIN.32.o obj/cpu_des.WIN.32.o obj/cpu_md5.WIN.32.o obj/cpu_sha1.WIN.32.o obj/cpu_sha256.WIN.32.o obj/data.WIN.32.o obj/ext_ADL.WIN.32.o obj/ext_nvapi.WIN.32.o obj/ext_nvml.WIN.32.o obj/ext_OpenCL.WIN.32.o obj/ext_xnvctrl.WIN.32.o obj/hwmon.WIN.32.o obj/interface.WIN.32.o obj/logfile.WIN.32.o obj/logging.WIN.32.o obj/memory.WIN.32.o obj/mpsp.WIN.32.o obj/rp_cpu.WIN.32.o obj/rp_kernel_on_cpu.WIN.32.o obj/shared.WIN.32.o obj/terminal.WIN.32.o obj/usage.WIN.32.o $(CRT_GLOB_32) +WIN_64_OBJS := obj/bitmap.WIN.64.o obj/opencl.WIN.64.o obj/affinity.WIN.64.o obj/filehandling.WIN.64.o obj/tuningdb.WIN.64.o obj/locking.WIN.64.o obj/folder.WIN.64.o obj/bitops.WIN.64.o obj/convert.WIN.64.o obj/cpu_aes.WIN.64.o obj/cpu_crc32.WIN.64.o obj/cpu_des.WIN.64.o obj/cpu_md5.WIN.64.o obj/cpu_sha1.WIN.64.o obj/cpu_sha256.WIN.64.o obj/data.WIN.64.o obj/ext_ADL.WIN.64.o obj/ext_nvapi.WIN.64.o obj/ext_nvml.WIN.64.o obj/ext_OpenCL.WIN.64.o obj/ext_xnvctrl.WIN.64.o obj/hwmon.WIN.64.o obj/interface.WIN.64.o obj/logfile.WIN.64.o obj/logging.WIN.64.o obj/memory.WIN.64.o obj/mpsp.WIN.64.o obj/rp_cpu.WIN.64.o obj/rp_kernel_on_cpu.WIN.64.o obj/shared.WIN.64.o obj/terminal.WIN.64.o obj/usage.WIN.64.o $(CRT_GLOB_64) ## ## Targets: Global diff --git a/src/bitmap.c b/src/bitmap.c new file mode 100644 index 000000000..2d01eceef --- /dev/null +++ b/src/bitmap.c @@ -0,0 +1,57 @@ +/** + * Authors.....: Jens Steube + * License.....: MIT + */ + +#include "common.h" +#include "types_int.h" +#include "bitmap.h" + +int sort_by_bitmap (const void *p1, const void *p2) +{ + const bitmap_result_t *b1 = (const bitmap_result_t *) p1; + const bitmap_result_t *b2 = (const bitmap_result_t *) p2; + + return b1->collisions - b2->collisions; +} + +uint generate_bitmaps (const uint digests_cnt, const uint dgst_size, const uint dgst_shifts, char *digests_buf_ptr, const uint dgst_pos0, const uint dgst_pos1, const uint dgst_pos2, const uint dgst_pos3, const uint bitmap_mask, const uint bitmap_size, uint *bitmap_a, uint *bitmap_b, uint *bitmap_c, uint *bitmap_d, const u64 collisions_max) +{ + u64 collisions = 0; + + memset (bitmap_a, 0, bitmap_size); + memset (bitmap_b, 0, bitmap_size); + memset (bitmap_c, 0, bitmap_size); + memset (bitmap_d, 0, bitmap_size); + + for (uint i = 0; i < digests_cnt; i++) + { + uint *digest_ptr = (uint *) digests_buf_ptr; + + digests_buf_ptr += dgst_size; + + const uint val0 = 1u << (digest_ptr[dgst_pos0] & 0x1f); + const uint val1 = 1u << (digest_ptr[dgst_pos1] & 0x1f); + const uint val2 = 1u << (digest_ptr[dgst_pos2] & 0x1f); + const uint val3 = 1u << (digest_ptr[dgst_pos3] & 0x1f); + + const uint idx0 = (digest_ptr[dgst_pos0] >> dgst_shifts) & bitmap_mask; + const uint idx1 = (digest_ptr[dgst_pos1] >> dgst_shifts) & bitmap_mask; + const uint idx2 = (digest_ptr[dgst_pos2] >> dgst_shifts) & bitmap_mask; + const uint idx3 = (digest_ptr[dgst_pos3] >> dgst_shifts) & bitmap_mask; + + if (bitmap_a[idx0] & val0) collisions++; + if (bitmap_b[idx1] & val1) collisions++; + if (bitmap_c[idx2] & val2) collisions++; + if (bitmap_d[idx3] & val3) collisions++; + + bitmap_a[idx0] |= val0; + bitmap_b[idx1] |= val1; + bitmap_c[idx2] |= val2; + bitmap_d[idx3] |= val3; + + if (collisions >= collisions_max) return 0x7fffffff; + } + + return collisions; +} diff --git a/src/hashcat.c b/src/hashcat.c index ce3a4e2c9..b1e5e19ab 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -59,6 +59,7 @@ #include "mpsp.h" #include "data.h" #include "affinity.h" +#include "bitmap.h" #include "usage.h" extern hc_global_data_t data; @@ -124,8 +125,6 @@ static double TARGET_MS_PROFILE[4] = { 2, 12, 96, 480 }; #define INCREMENT_MIN 1 #define INCREMENT_MAX PW_MAX #define SEPARATOR ':' -#define BITMAP_MIN 16 -#define BITMAP_MAX 24 #define NVIDIA_SPIN_DAMP 100 #define GPU_TEMP_DISABLE 0 #define GPU_TEMP_ABORT 90 @@ -5916,52 +5915,6 @@ static void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize) } #endif -static uint generate_bitmaps (const uint digests_cnt, const uint dgst_size, const uint dgst_shifts, char *digests_buf_ptr, const uint bitmap_mask, const uint bitmap_size, uint *bitmap_a, uint *bitmap_b, uint *bitmap_c, uint *bitmap_d, const u64 collisions_max) -{ - u64 collisions = 0; - - const uint dgst_pos0 = data.dgst_pos0; - const uint dgst_pos1 = data.dgst_pos1; - const uint dgst_pos2 = data.dgst_pos2; - const uint dgst_pos3 = data.dgst_pos3; - - memset (bitmap_a, 0, bitmap_size); - memset (bitmap_b, 0, bitmap_size); - memset (bitmap_c, 0, bitmap_size); - memset (bitmap_d, 0, bitmap_size); - - for (uint i = 0; i < digests_cnt; i++) - { - uint *digest_ptr = (uint *) digests_buf_ptr; - - digests_buf_ptr += dgst_size; - - const uint val0 = 1u << (digest_ptr[dgst_pos0] & 0x1f); - const uint val1 = 1u << (digest_ptr[dgst_pos1] & 0x1f); - const uint val2 = 1u << (digest_ptr[dgst_pos2] & 0x1f); - const uint val3 = 1u << (digest_ptr[dgst_pos3] & 0x1f); - - const uint idx0 = (digest_ptr[dgst_pos0] >> dgst_shifts) & bitmap_mask; - const uint idx1 = (digest_ptr[dgst_pos1] >> dgst_shifts) & bitmap_mask; - const uint idx2 = (digest_ptr[dgst_pos2] >> dgst_shifts) & bitmap_mask; - const uint idx3 = (digest_ptr[dgst_pos3] >> dgst_shifts) & bitmap_mask; - - if (bitmap_a[idx0] & val0) collisions++; - if (bitmap_b[idx1] & val1) collisions++; - if (bitmap_c[idx2] & val2) collisions++; - if (bitmap_d[idx3] & val3) collisions++; - - bitmap_a[idx0] |= val0; - bitmap_b[idx1] |= val1; - bitmap_c[idx2] |= val2; - bitmap_d[idx3] |= val3; - - if (collisions >= collisions_max) return 0x7fffffff; - } - - return collisions; -} - /** * main */ @@ -13843,8 +13796,8 @@ int main (int argc, char **argv) if ((hashes_cnt & bitmap_mask) == hashes_cnt) break; - if (generate_bitmaps (digests_cnt, dgst_size, bitmap_shift1, (char *) data.digests_buf, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, digests_cnt / 2) == 0x7fffffff) continue; - if (generate_bitmaps (digests_cnt, dgst_size, bitmap_shift2, (char *) data.digests_buf, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, digests_cnt / 2) == 0x7fffffff) continue; + if (generate_bitmaps (digests_cnt, dgst_size, bitmap_shift1, (char *) data.digests_buf, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, digests_cnt / 2) == 0x7fffffff) continue; + if (generate_bitmaps (digests_cnt, dgst_size, bitmap_shift2, (char *) data.digests_buf, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, digests_cnt / 2) == 0x7fffffff) continue; break; } @@ -13855,8 +13808,8 @@ int main (int argc, char **argv) bitmap_size = bitmap_nums * sizeof (uint); - generate_bitmaps (digests_cnt, dgst_size, bitmap_shift1, (char *) data.digests_buf, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, -1ul); - generate_bitmaps (digests_cnt, dgst_size, bitmap_shift2, (char *) data.digests_buf, bitmap_mask, bitmap_size, bitmap_s2_a, bitmap_s2_b, bitmap_s2_c, bitmap_s2_d, -1ul); + generate_bitmaps (digests_cnt, dgst_size, bitmap_shift1, (char *) data.digests_buf, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, -1ul); + generate_bitmaps (digests_cnt, dgst_size, bitmap_shift2, (char *) data.digests_buf, data.dgst_pos0, data.dgst_pos1, data.dgst_pos2, data.dgst_pos3, bitmap_mask, bitmap_size, bitmap_s2_a, bitmap_s2_b, bitmap_s2_c, bitmap_s2_d, -1ul); /** * prepare quick rule diff --git a/src/shared.c b/src/shared.c index 8f1deb13e..0279b1496 100644 --- a/src/shared.c +++ b/src/shared.c @@ -259,13 +259,6 @@ int sort_by_dictstat (const void *s1, const void *s2) return memcmp (&d1->stat, &d2->stat, sizeof (struct stat)); } -int sort_by_bitmap (const void *p1, const void *p2) -{ - const bitmap_result_t *b1 = (const bitmap_result_t *) p1; - const bitmap_result_t *b2 = (const bitmap_result_t *) p2; - - return b1->collisions - b2->collisions; -} int sort_by_digest_4_2 (const void *v1, const void *v2) {