mirror of
https://github.com/hashcat/hashcat
synced 2024-11-24 14:27:14 +01:00
Move bitmap specific functions into their own source file
This commit is contained in:
parent
5c5f3264dd
commit
1fc22dba03
25
include/bitmap.h
Normal file
25
include/bitmap.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* Author......: Jens Steube <jens.steube@gmail.com>
|
||||||
|
* License.....: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BITMAP_H
|
||||||
|
#define _BITMAP_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#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
|
@ -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_kernel_rule (const void *p1, const void *p2);
|
||||||
int sort_by_stringptr (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_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_pot (const void *v1, const void *v2);
|
||||||
int sort_by_hash (const void *v1, const void *v2);
|
int sort_by_hash (const void *v1, const void *v2);
|
||||||
|
@ -286,13 +286,6 @@ typedef struct
|
|||||||
|
|
||||||
} wl_data_t;
|
} wl_data_t;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint bitmap_shift;
|
|
||||||
uint collisions;
|
|
||||||
|
|
||||||
} bitmap_result_t;
|
|
||||||
|
|
||||||
#define CPT_BUF 0x20000
|
#define CPT_BUF 0x20000
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
10
src/Makefile
10
src/Makefile
@ -166,7 +166,7 @@ LFLAGS_CROSS_WIN := -lpsapi
|
|||||||
## Objects
|
## 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)
|
ifeq ($(UNAME),Linux)
|
||||||
NATIVE_OBJS += obj/ext_ADL.NATIVE.o
|
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
|
NATIVE_OBJS += obj/ext_xnvctrl.NATIVE.o
|
||||||
endif
|
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_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/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_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:
|
# 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
|
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_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/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_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
|
## Targets: Global
|
||||||
|
57
src/bitmap.c
Normal file
57
src/bitmap.c
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* Authors.....: Jens Steube <jens.steube@gmail.com>
|
||||||
|
* 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;
|
||||||
|
}
|
@ -59,6 +59,7 @@
|
|||||||
#include "mpsp.h"
|
#include "mpsp.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "affinity.h"
|
#include "affinity.h"
|
||||||
|
#include "bitmap.h"
|
||||||
#include "usage.h"
|
#include "usage.h"
|
||||||
|
|
||||||
extern hc_global_data_t data;
|
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_MIN 1
|
||||||
#define INCREMENT_MAX PW_MAX
|
#define INCREMENT_MAX PW_MAX
|
||||||
#define SEPARATOR ':'
|
#define SEPARATOR ':'
|
||||||
#define BITMAP_MIN 16
|
|
||||||
#define BITMAP_MAX 24
|
|
||||||
#define NVIDIA_SPIN_DAMP 100
|
#define NVIDIA_SPIN_DAMP 100
|
||||||
#define GPU_TEMP_DISABLE 0
|
#define GPU_TEMP_DISABLE 0
|
||||||
#define GPU_TEMP_ABORT 90
|
#define GPU_TEMP_ABORT 90
|
||||||
@ -5916,52 +5915,6 @@ static void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize)
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
* main
|
||||||
*/
|
*/
|
||||||
@ -13843,8 +13796,8 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
if ((hashes_cnt & bitmap_mask) == hashes_cnt) break;
|
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_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, 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;
|
break;
|
||||||
}
|
}
|
||||||
@ -13855,8 +13808,8 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
bitmap_size = bitmap_nums * sizeof (uint);
|
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_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, bitmap_mask, bitmap_size, bitmap_s2_a, bitmap_s2_b, bitmap_s2_c, bitmap_s2_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
|
* prepare quick rule
|
||||||
|
@ -259,13 +259,6 @@ int sort_by_dictstat (const void *s1, const void *s2)
|
|||||||
return memcmp (&d1->stat, &d2->stat, sizeof (struct stat));
|
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)
|
int sort_by_digest_4_2 (const void *v1, const void *v2)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user