1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-27 17:08:12 +00:00

Use dynloader.c instead of dlopen() directly

This commit is contained in:
jsteube 2018-12-19 16:09:28 +01:00
parent 15f546bc4e
commit 4028bae578
11 changed files with 518 additions and 521 deletions

View File

@ -22,9 +22,9 @@ HMODULE hc_dlopen (LPCSTR lpLibFileName);
BOOL hc_dlclose (HMODULE hLibModule); BOOL hc_dlclose (HMODULE hLibModule);
FARPROC hc_dlsym (HMODULE hModule, LPCSTR lpProcName); FARPROC hc_dlsym (HMODULE hModule, LPCSTR lpProcName);
#else #else
void *hc_dlopen (const char *fileName, int flag); void *hc_dlopen (const char *filename);
int hc_dlclose (void *handle); int hc_dlclose (void *handle);
void *hc_dlsym (void *module, const char *symbol); void *hc_dlsym (void *handle, const char *symbol);
#endif #endif
#define HC_LOAD_FUNC2(ptr,name,type,var,libname,noerr) \ #define HC_LOAD_FUNC2(ptr,name,type,var,libname,noerr) \

View File

@ -12,7 +12,6 @@
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <inttypes.h> #include <inttypes.h>
#include <dlfcn.h>
static const u32 MODULE_VERSION_MINIMUM = 520; static const u32 MODULE_VERSION_MINIMUM = 520;
@ -27,83 +26,6 @@ static const char LM_MASKED_PLAIN[] = "[notfound]";
* migrate stuff * migrate stuff
*/ */
typedef enum hash_type
{
HASH_TYPE_MD4 = 1,
HASH_TYPE_MD5 = 2,
HASH_TYPE_MD5H = 3,
HASH_TYPE_SHA1 = 4,
HASH_TYPE_SHA224 = 5,
HASH_TYPE_SHA256 = 6,
HASH_TYPE_SHA384 = 7,
HASH_TYPE_SHA512 = 8,
HASH_TYPE_DCC2 = 9,
HASH_TYPE_WPA_EAPOL = 10,
HASH_TYPE_LM = 11,
HASH_TYPE_DESCRYPT = 12,
HASH_TYPE_ORACLEH = 13,
HASH_TYPE_DESRACF = 14,
HASH_TYPE_BCRYPT = 15,
HASH_TYPE_NETNTLM = 17,
HASH_TYPE_RIPEMD160 = 18,
HASH_TYPE_WHIRLPOOL = 19,
HASH_TYPE_AES = 20,
HASH_TYPE_GOST = 21,
HASH_TYPE_KRB5PA = 22,
HASH_TYPE_SAPB = 23,
HASH_TYPE_SAPG = 24,
HASH_TYPE_MYSQL = 25,
HASH_TYPE_LOTUS5 = 26,
HASH_TYPE_LOTUS6 = 27,
HASH_TYPE_ANDROIDFDE = 28,
HASH_TYPE_SCRYPT = 29,
HASH_TYPE_LOTUS8 = 30,
HASH_TYPE_OFFICE2007 = 31,
HASH_TYPE_OFFICE2010 = 32,
HASH_TYPE_OFFICE2013 = 33,
HASH_TYPE_OLDOFFICE01 = 34,
HASH_TYPE_OLDOFFICE34 = 35,
HASH_TYPE_SIPHASH = 36,
HASH_TYPE_PDFU16 = 37,
HASH_TYPE_PDFU32 = 38,
HASH_TYPE_PBKDF2_SHA256 = 39,
HASH_TYPE_BITCOIN_WALLET = 40,
HASH_TYPE_CRC32 = 41,
HASH_TYPE_STREEBOG_256 = 42,
HASH_TYPE_STREEBOG_512 = 43,
HASH_TYPE_PBKDF2_MD5 = 44,
HASH_TYPE_PBKDF2_SHA1 = 45,
HASH_TYPE_PBKDF2_SHA512 = 46,
HASH_TYPE_ECRYPTFS = 47,
HASH_TYPE_ORACLET = 48,
HASH_TYPE_BSDICRYPT = 49,
HASH_TYPE_RAR3HP = 50,
HASH_TYPE_KRB5TGS = 51,
HASH_TYPE_STDOUT = 52,
HASH_TYPE_DES = 53,
HASH_TYPE_PLAINTEXT = 54,
HASH_TYPE_LUKS = 55,
HASH_TYPE_ITUNES_BACKUP_9 = 56,
HASH_TYPE_ITUNES_BACKUP_10 = 57,
HASH_TYPE_SKIP32 = 58,
HASH_TYPE_BLAKE2B = 59,
HASH_TYPE_CHACHA20 = 60,
HASH_TYPE_DPAPIMK = 61,
HASH_TYPE_JKS_SHA1 = 62,
HASH_TYPE_TACACS_PLUS = 63,
HASH_TYPE_APPLE_SECURE_NOTES = 64,
HASH_TYPE_CRAM_MD5_DOVECOT = 65,
HASH_TYPE_JWT = 66,
HASH_TYPE_ELECTRUM_WALLET = 67,
HASH_TYPE_WPA_PMKID_PBKDF2 = 68,
HASH_TYPE_WPA_PMKID_PMK = 69,
HASH_TYPE_ANSIBLE_VAULT = 70,
HASH_TYPE_KRB5ASREP = 71,
HASH_TYPE_ODF12 = 72,
HASH_TYPE_ODF11 = 73,
} hash_type_t;
typedef struct keyboard_layout_mapping typedef struct keyboard_layout_mapping
{ {
u32 src_char; u32 src_char;
@ -388,9 +310,4 @@ const char *default_st_pass (MAYBE_UNUSED const hashconfig_t *hash
u64 default_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); u64 default_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
bool default_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra); bool default_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
void decoder_apply_optimizer (const hashconfig_t *hashconfig, void *data);
void decoder_apply_options (const hashconfig_t *hashconfig, void *data);
void encoder_apply_optimizer (const hashconfig_t *hashconfig, void *data);
void encoder_apply_options (const hashconfig_t *hashconfig, void *data);
#endif // _INTERFACE_H #endif // _INTERFACE_H

View File

@ -89,4 +89,9 @@ const char *strparser (const u32 parser_status);
int input_tokenizer (const u8 *input_buf, const int input_len, token_t *token); int input_tokenizer (const u8 *input_buf, const int input_len, token_t *token);
void decoder_apply_optimizer (const hashconfig_t *hashconfig, void *data);
void decoder_apply_options (const hashconfig_t *hashconfig, void *data);
void encoder_apply_optimizer (const hashconfig_t *hashconfig, void *data);
void encoder_apply_options (const hashconfig_t *hashconfig, void *data);
#endif // _SHARED_H #endif // _SHARED_H

View File

@ -2350,3 +2350,84 @@ typedef struct token
} token_t; } token_t;
#endif // _TYPES_H #endif // _TYPES_H
/**
* migrate stuff
*/
typedef enum hash_type
{
HASH_TYPE_MD4 = 1,
HASH_TYPE_MD5 = 2,
HASH_TYPE_MD5H = 3,
HASH_TYPE_SHA1 = 4,
HASH_TYPE_SHA224 = 5,
HASH_TYPE_SHA256 = 6,
HASH_TYPE_SHA384 = 7,
HASH_TYPE_SHA512 = 8,
HASH_TYPE_DCC2 = 9,
HASH_TYPE_WPA_EAPOL = 10,
HASH_TYPE_LM = 11,
HASH_TYPE_DESCRYPT = 12,
HASH_TYPE_ORACLEH = 13,
HASH_TYPE_DESRACF = 14,
HASH_TYPE_BCRYPT = 15,
HASH_TYPE_NETNTLM = 17,
HASH_TYPE_RIPEMD160 = 18,
HASH_TYPE_WHIRLPOOL = 19,
HASH_TYPE_AES = 20,
HASH_TYPE_GOST = 21,
HASH_TYPE_KRB5PA = 22,
HASH_TYPE_SAPB = 23,
HASH_TYPE_SAPG = 24,
HASH_TYPE_MYSQL = 25,
HASH_TYPE_LOTUS5 = 26,
HASH_TYPE_LOTUS6 = 27,
HASH_TYPE_ANDROIDFDE = 28,
HASH_TYPE_SCRYPT = 29,
HASH_TYPE_LOTUS8 = 30,
HASH_TYPE_OFFICE2007 = 31,
HASH_TYPE_OFFICE2010 = 32,
HASH_TYPE_OFFICE2013 = 33,
HASH_TYPE_OLDOFFICE01 = 34,
HASH_TYPE_OLDOFFICE34 = 35,
HASH_TYPE_SIPHASH = 36,
HASH_TYPE_PDFU16 = 37,
HASH_TYPE_PDFU32 = 38,
HASH_TYPE_PBKDF2_SHA256 = 39,
HASH_TYPE_BITCOIN_WALLET = 40,
HASH_TYPE_CRC32 = 41,
HASH_TYPE_STREEBOG_256 = 42,
HASH_TYPE_STREEBOG_512 = 43,
HASH_TYPE_PBKDF2_MD5 = 44,
HASH_TYPE_PBKDF2_SHA1 = 45,
HASH_TYPE_PBKDF2_SHA512 = 46,
HASH_TYPE_ECRYPTFS = 47,
HASH_TYPE_ORACLET = 48,
HASH_TYPE_BSDICRYPT = 49,
HASH_TYPE_RAR3HP = 50,
HASH_TYPE_KRB5TGS = 51,
HASH_TYPE_STDOUT = 52,
HASH_TYPE_DES = 53,
HASH_TYPE_PLAINTEXT = 54,
HASH_TYPE_LUKS = 55,
HASH_TYPE_ITUNES_BACKUP_9 = 56,
HASH_TYPE_ITUNES_BACKUP_10 = 57,
HASH_TYPE_SKIP32 = 58,
HASH_TYPE_BLAKE2B = 59,
HASH_TYPE_CHACHA20 = 60,
HASH_TYPE_DPAPIMK = 61,
HASH_TYPE_JKS_SHA1 = 62,
HASH_TYPE_TACACS_PLUS = 63,
HASH_TYPE_APPLE_SECURE_NOTES = 64,
HASH_TYPE_CRAM_MD5_DOVECOT = 65,
HASH_TYPE_JWT = 66,
HASH_TYPE_ELECTRUM_WALLET = 67,
HASH_TYPE_WPA_PMKID_PBKDF2 = 68,
HASH_TYPE_WPA_PMKID_PMK = 69,
HASH_TYPE_ANSIBLE_VAULT = 70,
HASH_TYPE_KRB5ASREP = 71,
HASH_TYPE_ODF12 = 72,
HASH_TYPE_ODF11 = 73,
} hash_type_t;

View File

@ -539,7 +539,7 @@ endif
## native compiled modules ## native compiled modules
## ##
MODULE_DEPEND := src/bitops.c src/convert.c src/interface.c src/shared.c MODULE_DEPEND := src/bitops.c src/convert.c src/memory.c src/shared.c
MODULES_SRC := $(wildcard modules/*.c) MODULES_SRC := $(wildcard modules/*.c)
MODULES_LIB := $(patsubst %.c, %.so, $(MODULES_SRC)) MODULES_LIB := $(patsubst %.c, %.so, $(MODULES_SRC))

View File

@ -25,19 +25,19 @@ FARPROC hc_dlsym (HMODULE hModule, LPCSTR lpProcName)
#else #else
void *hc_dlopen (const char *fileName, int flag) void *hc_dlopen (const char *filename)
{ {
return dlopen (fileName, flag); return dlopen (filename, RTLD_NOW);
} }
int hc_dlclose (void * handle) int hc_dlclose (void *handle)
{ {
return dlclose (handle); return dlclose (handle);
} }
void *hc_dlsym (void *module, const char *symbol) void *hc_dlsym (void *handle, const char *symbol)
{ {
return dlsym (module, symbol); return dlsym (handle, symbol);
} }
#endif #endif

View File

@ -456,7 +456,7 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx)
#elif defined (__CYGWIN__) #elif defined (__CYGWIN__)
nvml->lib = hc_dlopen("nvml.dll", RTLD_NOW); nvml->lib = hc_dlopen("nvml.dll");
if (!nvml->lib) if (!nvml->lib)
{ {
@ -496,16 +496,16 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx)
strcat (nvml_cygpath, "/nvml.dll"); strcat (nvml_cygpath, "/nvml.dll");
nvml->lib = hc_dlopen (nvml_cygpath, RTLD_NOW); nvml->lib = hc_dlopen (nvml_cygpath);
} }
#elif defined (_POSIX) #elif defined (_POSIX)
nvml->lib = hc_dlopen ("libnvidia-ml.so", RTLD_NOW); nvml->lib = hc_dlopen ("libnvidia-ml.so");
if (!nvml->lib) if (!nvml->lib)
{ {
nvml->lib = hc_dlopen ("libnvidia-ml.so.1", RTLD_NOW); nvml->lib = hc_dlopen ("libnvidia-ml.so.1");
} }
#endif #endif
@ -801,13 +801,13 @@ static int nvapi_init (hashcat_ctx_t *hashcat_ctx)
#if defined (__CYGWIN__) #if defined (__CYGWIN__)
#if defined (__x86_x64__) #if defined (__x86_x64__)
nvapi->lib = hc_dlopen ("nvapi64.dll", RTLD_NOW); nvapi->lib = hc_dlopen ("nvapi64.dll");
#else #else
nvapi->lib = hc_dlopen ("nvapi.dll", RTLD_NOW); nvapi->lib = hc_dlopen ("nvapi.dll");
#endif #endif
#else #else
nvapi->lib = hc_dlopen ("nvapi.so", RTLD_NOW); // uhm yes, but .. yeah nvapi->lib = hc_dlopen ("nvapi.so"); // uhm yes, but .. yeah
#endif #endif
#endif #endif
@ -1027,14 +1027,14 @@ static int adl_init (hashcat_ctx_t *hashcat_ctx)
adl->lib = hc_dlopen ("atiadlxy.dll"); adl->lib = hc_dlopen ("atiadlxy.dll");
} }
#elif defined (__CYGWIN__) #elif defined (__CYGWIN__)
adl->lib = hc_dlopen ("atiadlxx.dll", RTLD_NOW); adl->lib = hc_dlopen ("atiadlxx.dll");
if (!adl->lib) if (!adl->lib)
{ {
adl->lib = hc_dlopen ("atiadlxy.dll", RTLD_NOW); adl->lib = hc_dlopen ("atiadlxy.dll");
} }
#elif defined (_POSIX) #elif defined (_POSIX)
adl->lib = hc_dlopen ("libatiadlxx.so", RTLD_NOW); adl->lib = hc_dlopen ("libatiadlxx.so");
#endif #endif
if (!adl->lib) if (!adl->lib)

View File

@ -9,21 +9,14 @@
#include "memory.h" #include "memory.h"
#include "convert.h" #include "convert.h"
#include "event.h" #include "event.h"
#include "inc_hash_constants.h"
#include "cpu_aes.h"
#include "cpu_crc32.h"
#include "cpu_des.h"
#include "cpu_md4.h"
#include "cpu_md5.h"
#include "cpu_sha1.h"
#include "cpu_sha256.h"
#include "cpu_blake2.h"
#include "shared.h" #include "shared.h"
#include "opencl.h" #include "opencl.h"
#include "interface.h" #include "interface.h"
#include "filehandling.h" #include "filehandling.h"
#include "ext_lzma.h" #include "ext_lzma.h"
#include "modules.h" #include "modules.h"
#include "dynloader.h"
#include "cpu_crc32.h"
static const char *ST_PASS_HASHCAT_PLAIN = "hashcat"; static const char *ST_PASS_HASHCAT_PLAIN = "hashcat";
static const char *ST_PASS_HASHCAT_EXCL = "hashcat!"; static const char *ST_PASS_HASHCAT_EXCL = "hashcat!";
@ -263,18 +256,6 @@ static bool parse_and_store_generic_salt (u8 *out_buf, int *out_len, const u8 *i
return true; return true;
} }
static void precompute_salt_md5 (const u32 *salt_buf, const u32 salt_len, u8 *salt_pc)
{
u32 digest[4] = { 0 };
md5_complete_no_limit (digest, salt_buf, salt_len);
u32_to_hex (digest[0], salt_pc + 0);
u32_to_hex (digest[1], salt_pc + 8);
u32_to_hex (digest[2], salt_pc + 16);
u32_to_hex (digest[3], salt_pc + 24);
}
/** /**
* output * output
*/ */
@ -635,36 +616,40 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const int out_size,
static bool module_load (hashcat_ctx_t *hashcat_ctx, module_ctx_t *module_ctx, const u32 hash_mode) static bool module_load (hashcat_ctx_t *hashcat_ctx, module_ctx_t *module_ctx, const u32 hash_mode)
{ {
const folder_config_t *folder_config = hashcat_ctx->folder_config;
char *module_file = (char *) hcmalloc (HCBUFSIZ_TINY); char *module_file = (char *) hcmalloc (HCBUFSIZ_TINY);
#if defined (_WIN)
snprintf (module_file, HCBUFSIZ_TINY, "%s/modules/module_%05d.dll", folder_config->shared_dir, hash_mode);
#else
snprintf (module_file, HCBUFSIZ_TINY, "%s/modules/module_%05d.so", folder_config->shared_dir, hash_mode);
#endif
module_ctx->module_handle = hc_dlopen (module_file);
if (module_ctx->module_handle == NULL)
{
event_log_error (hashcat_ctx, "Cannot load module %s", module_file);
#if defined (_WIN) #if defined (_WIN)
#else #else
const folder_config_t *folder_config = hashcat_ctx->folder_config;
snprintf (module_file, HCBUFSIZ_TINY, "%s/modules/module_%05d.so", folder_config->shared_dir, hash_mode);
module_ctx->module_handle = dlopen (module_file, RTLD_LAZY);
if (module_ctx->module_handle == NULL)
{
event_log_error (hashcat_ctx, "%s", dlerror ()); event_log_error (hashcat_ctx, "%s", dlerror ());
#endif
return false; return false;
} }
module_ctx->module_init = dlsym (module_ctx->module_handle, "module_init"); module_ctx->module_init = hc_dlsym (module_ctx->module_handle, "module_init");
if (module_ctx->module_init == NULL) if (module_ctx->module_init == NULL)
{ {
event_log_error (hashcat_ctx, "%s", dlerror ()); event_log_error (hashcat_ctx, "Cannot load symbol 'module_init' in module %s", module_file);
return false; return false;
} }
#endif
free (module_file); free (module_file);
return true; return true;
@ -672,13 +657,7 @@ static bool module_load (hashcat_ctx_t *hashcat_ctx, module_ctx_t *module_ctx, c
static void module_unload (module_ctx_t *module_ctx) static void module_unload (module_ctx_t *module_ctx)
{ {
#if defined (_WIN) hc_dlclose (module_ctx->module_handle);
#else
dlclose (module_ctx->module_handle);
#endif
} }
int hashconfig_init (hashcat_ctx_t *hashcat_ctx) int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
@ -1053,384 +1032,6 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo
} }
} }
void decoder_apply_optimizer (const hashconfig_t *hashconfig, void *data)
{
const u32 hash_type = hashconfig->hash_type;
const u32 opti_type = hashconfig->opti_type;
u32 *digest_buf = (u32 *) data;
u64 *digest_buf64 = (u64 *) data;
if (opti_type & OPTI_TYPE_PRECOMPUTE_PERMUT)
{
u32 tt;
switch (hash_type)
{
case HASH_TYPE_DES:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_DESCRYPT:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_DESRACF:
digest_buf[0] = rotl32 (digest_buf[0], 29);
digest_buf[1] = rotl32 (digest_buf[1], 29);
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_LM:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_NETNTLM:
digest_buf[0] = rotl32 (digest_buf[0], 29);
digest_buf[1] = rotl32 (digest_buf[1], 29);
digest_buf[2] = rotl32 (digest_buf[2], 29);
digest_buf[3] = rotl32 (digest_buf[3], 29);
FP (digest_buf[1], digest_buf[0], tt);
FP (digest_buf[3], digest_buf[2], tt);
break;
case HASH_TYPE_BSDICRYPT:
digest_buf[0] = rotl32 (digest_buf[0], 31);
digest_buf[1] = rotl32 (digest_buf[1], 31);
FP (digest_buf[1], digest_buf[0], tt);
break;
}
}
if (opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE)
{
switch (hash_type)
{
case HASH_TYPE_MD4:
digest_buf[0] -= MD4M_A;
digest_buf[1] -= MD4M_B;
digest_buf[2] -= MD4M_C;
digest_buf[3] -= MD4M_D;
break;
case HASH_TYPE_MD5:
digest_buf[0] -= MD5M_A;
digest_buf[1] -= MD5M_B;
digest_buf[2] -= MD5M_C;
digest_buf[3] -= MD5M_D;
break;
case HASH_TYPE_SHA1:
digest_buf[0] -= SHA1M_A;
digest_buf[1] -= SHA1M_B;
digest_buf[2] -= SHA1M_C;
digest_buf[3] -= SHA1M_D;
digest_buf[4] -= SHA1M_E;
break;
case HASH_TYPE_SHA224:
digest_buf[0] -= SHA224M_A;
digest_buf[1] -= SHA224M_B;
digest_buf[2] -= SHA224M_C;
digest_buf[3] -= SHA224M_D;
digest_buf[4] -= SHA224M_E;
digest_buf[5] -= SHA224M_F;
digest_buf[6] -= SHA224M_G;
break;
case HASH_TYPE_SHA256:
digest_buf[0] -= SHA256M_A;
digest_buf[1] -= SHA256M_B;
digest_buf[2] -= SHA256M_C;
digest_buf[3] -= SHA256M_D;
digest_buf[4] -= SHA256M_E;
digest_buf[5] -= SHA256M_F;
digest_buf[6] -= SHA256M_G;
digest_buf[7] -= SHA256M_H;
break;
case HASH_TYPE_SHA384:
digest_buf64[0] -= SHA384M_A;
digest_buf64[1] -= SHA384M_B;
digest_buf64[2] -= SHA384M_C;
digest_buf64[3] -= SHA384M_D;
digest_buf64[4] -= SHA384M_E;
digest_buf64[5] -= SHA384M_F;
digest_buf64[6] -= 0;
digest_buf64[7] -= 0;
break;
case HASH_TYPE_SHA512:
digest_buf64[0] -= SHA512M_A;
digest_buf64[1] -= SHA512M_B;
digest_buf64[2] -= SHA512M_C;
digest_buf64[3] -= SHA512M_D;
digest_buf64[4] -= SHA512M_E;
digest_buf64[5] -= SHA512M_F;
digest_buf64[6] -= SHA512M_G;
digest_buf64[7] -= SHA512M_H;
break;
}
}
}
void encoder_apply_optimizer (const hashconfig_t *hashconfig, void *data)
{
const u32 hash_type = hashconfig->hash_type;
const u32 opti_type = hashconfig->opti_type;
u32 *digest_buf = (u32 *) data;
u64 *digest_buf64 = (u64 *) data;
if (opti_type & OPTI_TYPE_PRECOMPUTE_PERMUT)
{
u32 tt;
switch (hash_type)
{
case HASH_TYPE_DES:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_DESCRYPT:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_DESRACF:
digest_buf[0] = rotl32 (digest_buf[0], 29);
digest_buf[1] = rotl32 (digest_buf[1], 29);
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_LM:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_NETNTLM:
digest_buf[0] = rotl32 (digest_buf[0], 29);
digest_buf[1] = rotl32 (digest_buf[1], 29);
digest_buf[2] = rotl32 (digest_buf[2], 29);
digest_buf[3] = rotl32 (digest_buf[3], 29);
FP (digest_buf[1], digest_buf[0], tt);
FP (digest_buf[3], digest_buf[2], tt);
break;
case HASH_TYPE_BSDICRYPT:
digest_buf[0] = rotl32 (digest_buf[0], 31);
digest_buf[1] = rotl32 (digest_buf[1], 31);
FP (digest_buf[1], digest_buf[0], tt);
break;
}
}
if (opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE)
{
switch (hash_type)
{
case HASH_TYPE_MD4:
digest_buf[0] += MD4M_A;
digest_buf[1] += MD4M_B;
digest_buf[2] += MD4M_C;
digest_buf[3] += MD4M_D;
break;
case HASH_TYPE_MD5:
digest_buf[0] += MD5M_A;
digest_buf[1] += MD5M_B;
digest_buf[2] += MD5M_C;
digest_buf[3] += MD5M_D;
break;
case HASH_TYPE_SHA1:
digest_buf[0] += SHA1M_A;
digest_buf[1] += SHA1M_B;
digest_buf[2] += SHA1M_C;
digest_buf[3] += SHA1M_D;
digest_buf[4] += SHA1M_E;
break;
case HASH_TYPE_SHA224:
digest_buf[0] += SHA224M_A;
digest_buf[1] += SHA224M_B;
digest_buf[2] += SHA224M_C;
digest_buf[3] += SHA224M_D;
digest_buf[4] += SHA224M_E;
digest_buf[5] += SHA224M_F;
digest_buf[6] += SHA224M_G;
break;
case HASH_TYPE_SHA256:
digest_buf[0] += SHA256M_A;
digest_buf[1] += SHA256M_B;
digest_buf[2] += SHA256M_C;
digest_buf[3] += SHA256M_D;
digest_buf[4] += SHA256M_E;
digest_buf[5] += SHA256M_F;
digest_buf[6] += SHA256M_G;
digest_buf[7] += SHA256M_H;
break;
case HASH_TYPE_SHA384:
digest_buf64[0] += SHA384M_A;
digest_buf64[1] += SHA384M_B;
digest_buf64[2] += SHA384M_C;
digest_buf64[3] += SHA384M_D;
digest_buf64[4] += SHA384M_E;
digest_buf64[5] += SHA384M_F;
digest_buf64[6] += 0;
digest_buf64[7] += 0;
break;
case HASH_TYPE_SHA512:
digest_buf64[0] += SHA512M_A;
digest_buf64[1] += SHA512M_B;
digest_buf64[2] += SHA512M_C;
digest_buf64[3] += SHA512M_D;
digest_buf64[4] += SHA512M_E;
digest_buf64[5] += SHA512M_F;
digest_buf64[6] += SHA512M_G;
digest_buf64[7] += SHA512M_H;
break;
}
}
}
void decoder_apply_options (const hashconfig_t *hashconfig, void *data)
{
const u32 hash_type = hashconfig->hash_type;
const u64 opts_type = hashconfig->opts_type;
const u32 dgst_size = hashconfig->dgst_size;
u32 *digest_buf = (u32 *) data;
u64 *digest_buf64 = (u64 *) data;
if (opts_type & OPTS_TYPE_STATE_BUFFER_BE)
{
if (dgst_size == DGST_SIZE_4_2)
{
for (int i = 0; i < 2; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_4)
{
for (int i = 0; i < 4; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_5)
{
for (int i = 0; i < 5; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_6)
{
for (int i = 0; i < 6; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_7)
{
for (int i = 0; i < 7; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_8)
{
for (int i = 0; i < 8; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if ((dgst_size == DGST_SIZE_4_16) || (dgst_size == DGST_SIZE_8_8)) // same size, same result :)
{
if (hash_type == HASH_TYPE_WHIRLPOOL)
{
for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (hash_type == HASH_TYPE_SHA384)
{
for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
else if (hash_type == HASH_TYPE_SHA512)
{
for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
else if (hash_type == HASH_TYPE_GOST)
{
for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
}
else if (dgst_size == DGST_SIZE_4_64)
{
for (int i = 0; i < 64; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_8_25)
{
for (int i = 0; i < 25; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
}
}
void encoder_apply_options (const hashconfig_t *hashconfig, void *data)
{
const u32 hash_type = hashconfig->hash_type;
const u64 opts_type = hashconfig->opts_type;
const u32 dgst_size = hashconfig->dgst_size;
u32 *digest_buf = (u32 *) data;
u64 *digest_buf64 = (u64 *) data;
if (opts_type & OPTS_TYPE_STATE_BUFFER_BE)
{
if (dgst_size == DGST_SIZE_4_2)
{
for (int i = 0; i < 2; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_4)
{
for (int i = 0; i < 4; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_5)
{
for (int i = 0; i < 5; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_6)
{
for (int i = 0; i < 6; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_7)
{
for (int i = 0; i < 7; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_8)
{
for (int i = 0; i < 8; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if ((dgst_size == DGST_SIZE_4_16) || (dgst_size == DGST_SIZE_8_8)) // same size, same result :)
{
if (hash_type == HASH_TYPE_WHIRLPOOL)
{
for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (hash_type == HASH_TYPE_SHA384)
{
for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
else if (hash_type == HASH_TYPE_SHA512)
{
for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
else if (hash_type == HASH_TYPE_GOST)
{
for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
}
else if (dgst_size == DGST_SIZE_4_64)
{
for (int i = 0; i < 64; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_8_25)
{
for (int i = 0; i < 25; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
}
}
u32 default_hash_mode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) u32 default_hash_mode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
{ {
const u32 hash_mode = user_options->hash_mode; const u32 hash_mode = user_options->hash_mode;

View File

@ -28350,3 +28350,15 @@ void module_hook23 (hc_device_param_t *device_param, const void *hook_salts_buf,
} }
} }
} }
static void precompute_salt_md5 (const u32 *salt_buf, const u32 salt_len, u8 *salt_pc)
{
u32 digest[4] = { 0 };
md5_complete_no_limit (digest, salt_buf, salt_len);
u32_to_hex (digest[0], salt_pc + 0);
u32_to_hex (digest[1], salt_pc + 8);
u32_to_hex (digest[2], salt_pc + 16);
u32_to_hex (digest[3], salt_pc + 24);
}

View File

@ -486,15 +486,15 @@ int ocl_init (hashcat_ctx_t *hashcat_ctx)
#if defined (_WIN) #if defined (_WIN)
ocl->lib = hc_dlopen ("OpenCL"); ocl->lib = hc_dlopen ("OpenCL");
#elif defined (__APPLE__) #elif defined (__APPLE__)
ocl->lib = hc_dlopen ("/System/Library/Frameworks/OpenCL.framework/OpenCL", RTLD_NOW); ocl->lib = hc_dlopen ("/System/Library/Frameworks/OpenCL.framework/OpenCL");
#elif defined (__CYGWIN__) #elif defined (__CYGWIN__)
ocl->lib = hc_dlopen ("opencl.dll", RTLD_NOW); ocl->lib = hc_dlopen ("opencl.dll");
if (ocl->lib == NULL) ocl->lib = hc_dlopen ("cygOpenCL-1.dll", RTLD_NOW); if (ocl->lib == NULL) ocl->lib = hc_dlopen ("cygOpenCL-1.dll");
#else #else
ocl->lib = hc_dlopen ("libOpenCL.so", RTLD_NOW); ocl->lib = hc_dlopen ("libOpenCL.so");
if (ocl->lib == NULL) ocl->lib = hc_dlopen ("libOpenCL.so.1", RTLD_NOW); if (ocl->lib == NULL) ocl->lib = hc_dlopen ("libOpenCL.so.1");
#endif #endif
if (ocl->lib == NULL) if (ocl->lib == NULL)

View File

@ -5,8 +5,11 @@
#include "common.h" #include "common.h"
#include "types.h" #include "types.h"
#include "bitops.h"
#include "convert.h" #include "convert.h"
#include "shared.h" #include "shared.h"
#include "inc_hash_constants.h"
#include "cpu_des.h"
#if defined (__CYGWIN__) #if defined (__CYGWIN__)
#include <sys/cygwin.h> #include <sys/cygwin.h>
@ -1009,3 +1012,381 @@ int input_tokenizer (const u8 *input_buf, const int input_len, token_t *token)
return PARSER_OK; return PARSER_OK;
} }
void decoder_apply_optimizer (const hashconfig_t *hashconfig, void *data)
{
const u32 hash_type = hashconfig->hash_type;
const u32 opti_type = hashconfig->opti_type;
u32 *digest_buf = (u32 *) data;
u64 *digest_buf64 = (u64 *) data;
if (opti_type & OPTI_TYPE_PRECOMPUTE_PERMUT)
{
u32 tt;
switch (hash_type)
{
case HASH_TYPE_DES:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_DESCRYPT:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_DESRACF:
digest_buf[0] = rotl32 (digest_buf[0], 29);
digest_buf[1] = rotl32 (digest_buf[1], 29);
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_LM:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_NETNTLM:
digest_buf[0] = rotl32 (digest_buf[0], 29);
digest_buf[1] = rotl32 (digest_buf[1], 29);
digest_buf[2] = rotl32 (digest_buf[2], 29);
digest_buf[3] = rotl32 (digest_buf[3], 29);
FP (digest_buf[1], digest_buf[0], tt);
FP (digest_buf[3], digest_buf[2], tt);
break;
case HASH_TYPE_BSDICRYPT:
digest_buf[0] = rotl32 (digest_buf[0], 31);
digest_buf[1] = rotl32 (digest_buf[1], 31);
FP (digest_buf[1], digest_buf[0], tt);
break;
}
}
if (opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE)
{
switch (hash_type)
{
case HASH_TYPE_MD4:
digest_buf[0] -= MD4M_A;
digest_buf[1] -= MD4M_B;
digest_buf[2] -= MD4M_C;
digest_buf[3] -= MD4M_D;
break;
case HASH_TYPE_MD5:
digest_buf[0] -= MD5M_A;
digest_buf[1] -= MD5M_B;
digest_buf[2] -= MD5M_C;
digest_buf[3] -= MD5M_D;
break;
case HASH_TYPE_SHA1:
digest_buf[0] -= SHA1M_A;
digest_buf[1] -= SHA1M_B;
digest_buf[2] -= SHA1M_C;
digest_buf[3] -= SHA1M_D;
digest_buf[4] -= SHA1M_E;
break;
case HASH_TYPE_SHA224:
digest_buf[0] -= SHA224M_A;
digest_buf[1] -= SHA224M_B;
digest_buf[2] -= SHA224M_C;
digest_buf[3] -= SHA224M_D;
digest_buf[4] -= SHA224M_E;
digest_buf[5] -= SHA224M_F;
digest_buf[6] -= SHA224M_G;
break;
case HASH_TYPE_SHA256:
digest_buf[0] -= SHA256M_A;
digest_buf[1] -= SHA256M_B;
digest_buf[2] -= SHA256M_C;
digest_buf[3] -= SHA256M_D;
digest_buf[4] -= SHA256M_E;
digest_buf[5] -= SHA256M_F;
digest_buf[6] -= SHA256M_G;
digest_buf[7] -= SHA256M_H;
break;
case HASH_TYPE_SHA384:
digest_buf64[0] -= SHA384M_A;
digest_buf64[1] -= SHA384M_B;
digest_buf64[2] -= SHA384M_C;
digest_buf64[3] -= SHA384M_D;
digest_buf64[4] -= SHA384M_E;
digest_buf64[5] -= SHA384M_F;
digest_buf64[6] -= 0;
digest_buf64[7] -= 0;
break;
case HASH_TYPE_SHA512:
digest_buf64[0] -= SHA512M_A;
digest_buf64[1] -= SHA512M_B;
digest_buf64[2] -= SHA512M_C;
digest_buf64[3] -= SHA512M_D;
digest_buf64[4] -= SHA512M_E;
digest_buf64[5] -= SHA512M_F;
digest_buf64[6] -= SHA512M_G;
digest_buf64[7] -= SHA512M_H;
break;
}
}
}
void encoder_apply_optimizer (const hashconfig_t *hashconfig, void *data)
{
const u32 hash_type = hashconfig->hash_type;
const u32 opti_type = hashconfig->opti_type;
u32 *digest_buf = (u32 *) data;
u64 *digest_buf64 = (u64 *) data;
if (opti_type & OPTI_TYPE_PRECOMPUTE_PERMUT)
{
u32 tt;
switch (hash_type)
{
case HASH_TYPE_DES:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_DESCRYPT:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_DESRACF:
digest_buf[0] = rotl32 (digest_buf[0], 29);
digest_buf[1] = rotl32 (digest_buf[1], 29);
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_LM:
FP (digest_buf[1], digest_buf[0], tt);
break;
case HASH_TYPE_NETNTLM:
digest_buf[0] = rotl32 (digest_buf[0], 29);
digest_buf[1] = rotl32 (digest_buf[1], 29);
digest_buf[2] = rotl32 (digest_buf[2], 29);
digest_buf[3] = rotl32 (digest_buf[3], 29);
FP (digest_buf[1], digest_buf[0], tt);
FP (digest_buf[3], digest_buf[2], tt);
break;
case HASH_TYPE_BSDICRYPT:
digest_buf[0] = rotl32 (digest_buf[0], 31);
digest_buf[1] = rotl32 (digest_buf[1], 31);
FP (digest_buf[1], digest_buf[0], tt);
break;
}
}
if (opti_type & OPTI_TYPE_PRECOMPUTE_MERKLE)
{
switch (hash_type)
{
case HASH_TYPE_MD4:
digest_buf[0] += MD4M_A;
digest_buf[1] += MD4M_B;
digest_buf[2] += MD4M_C;
digest_buf[3] += MD4M_D;
break;
case HASH_TYPE_MD5:
digest_buf[0] += MD5M_A;
digest_buf[1] += MD5M_B;
digest_buf[2] += MD5M_C;
digest_buf[3] += MD5M_D;
break;
case HASH_TYPE_SHA1:
digest_buf[0] += SHA1M_A;
digest_buf[1] += SHA1M_B;
digest_buf[2] += SHA1M_C;
digest_buf[3] += SHA1M_D;
digest_buf[4] += SHA1M_E;
break;
case HASH_TYPE_SHA224:
digest_buf[0] += SHA224M_A;
digest_buf[1] += SHA224M_B;
digest_buf[2] += SHA224M_C;
digest_buf[3] += SHA224M_D;
digest_buf[4] += SHA224M_E;
digest_buf[5] += SHA224M_F;
digest_buf[6] += SHA224M_G;
break;
case HASH_TYPE_SHA256:
digest_buf[0] += SHA256M_A;
digest_buf[1] += SHA256M_B;
digest_buf[2] += SHA256M_C;
digest_buf[3] += SHA256M_D;
digest_buf[4] += SHA256M_E;
digest_buf[5] += SHA256M_F;
digest_buf[6] += SHA256M_G;
digest_buf[7] += SHA256M_H;
break;
case HASH_TYPE_SHA384:
digest_buf64[0] += SHA384M_A;
digest_buf64[1] += SHA384M_B;
digest_buf64[2] += SHA384M_C;
digest_buf64[3] += SHA384M_D;
digest_buf64[4] += SHA384M_E;
digest_buf64[5] += SHA384M_F;
digest_buf64[6] += 0;
digest_buf64[7] += 0;
break;
case HASH_TYPE_SHA512:
digest_buf64[0] += SHA512M_A;
digest_buf64[1] += SHA512M_B;
digest_buf64[2] += SHA512M_C;
digest_buf64[3] += SHA512M_D;
digest_buf64[4] += SHA512M_E;
digest_buf64[5] += SHA512M_F;
digest_buf64[6] += SHA512M_G;
digest_buf64[7] += SHA512M_H;
break;
}
}
}
void decoder_apply_options (const hashconfig_t *hashconfig, void *data)
{
const u32 hash_type = hashconfig->hash_type;
const u64 opts_type = hashconfig->opts_type;
const u32 dgst_size = hashconfig->dgst_size;
u32 *digest_buf = (u32 *) data;
u64 *digest_buf64 = (u64 *) data;
if (opts_type & OPTS_TYPE_STATE_BUFFER_BE)
{
if (dgst_size == DGST_SIZE_4_2)
{
for (int i = 0; i < 2; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_4)
{
for (int i = 0; i < 4; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_5)
{
for (int i = 0; i < 5; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_6)
{
for (int i = 0; i < 6; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_7)
{
for (int i = 0; i < 7; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_8)
{
for (int i = 0; i < 8; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if ((dgst_size == DGST_SIZE_4_16) || (dgst_size == DGST_SIZE_8_8)) // same size, same result :)
{
if (hash_type == HASH_TYPE_WHIRLPOOL)
{
for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (hash_type == HASH_TYPE_SHA384)
{
for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
else if (hash_type == HASH_TYPE_SHA512)
{
for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
else if (hash_type == HASH_TYPE_GOST)
{
for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
}
else if (dgst_size == DGST_SIZE_4_64)
{
for (int i = 0; i < 64; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_8_25)
{
for (int i = 0; i < 25; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
}
}
void encoder_apply_options (const hashconfig_t *hashconfig, void *data)
{
const u32 hash_type = hashconfig->hash_type;
const u64 opts_type = hashconfig->opts_type;
const u32 dgst_size = hashconfig->dgst_size;
u32 *digest_buf = (u32 *) data;
u64 *digest_buf64 = (u64 *) data;
if (opts_type & OPTS_TYPE_STATE_BUFFER_BE)
{
if (dgst_size == DGST_SIZE_4_2)
{
for (int i = 0; i < 2; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_4)
{
for (int i = 0; i < 4; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_5)
{
for (int i = 0; i < 5; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_6)
{
for (int i = 0; i < 6; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_7)
{
for (int i = 0; i < 7; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_4_8)
{
for (int i = 0; i < 8; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if ((dgst_size == DGST_SIZE_4_16) || (dgst_size == DGST_SIZE_8_8)) // same size, same result :)
{
if (hash_type == HASH_TYPE_WHIRLPOOL)
{
for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (hash_type == HASH_TYPE_SHA384)
{
for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
else if (hash_type == HASH_TYPE_SHA512)
{
for (int i = 0; i < 8; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
else if (hash_type == HASH_TYPE_GOST)
{
for (int i = 0; i < 16; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
}
else if (dgst_size == DGST_SIZE_4_64)
{
for (int i = 0; i < 64; i++) digest_buf[i] = byte_swap_32 (digest_buf[i]);
}
else if (dgst_size == DGST_SIZE_8_25)
{
for (int i = 0; i < 25; i++) digest_buf64[i] = byte_swap_64 (digest_buf64[i]);
}
}
}