*/
#include "cpu-md5.c"
+#include "cpu-sha1.c"
#include "cpu-sha256.c"
/**
if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
#ifdef HAVE_ADL
- if (data.devices_param[device_id].vendor_id == VENDOR_ID_AMD)
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
{
if (data.hm_amd)
{
#endif
#if defined(HAVE_NVML) || defined(HAVE_NVAPI)
- if (data.devices_param[device_id].vendor_id == VENDOR_ID_NV)
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
{
#if defined(LINUX) && defined(HAVE_NVML)
int temperature = 0;
if (data.hm_device[device_id].fan_supported == 1)
{
#ifdef HAVE_ADL
- if (data.devices_param[device_id].vendor_id == VENDOR_ID_AMD)
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
{
if (data.hm_amd)
{
#endif // HAVE_ADL
#if defined(HAVE_NVML) || defined(HAVE_NVAPI)
- if (data.devices_param[device_id].vendor_id == VENDOR_ID_NV)
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
{
#if defined(LINUX) && defined(HAVE_NVML)
int speed = 0;
if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
#ifdef HAVE_ADL
- if (data.devices_param[device_id].vendor_id == VENDOR_ID_AMD)
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
{
if (data.hm_amd)
{
#endif // HAVE_ADL
#if defined(HAVE_NVML) || defined(HAVE_NVAPI)
- if (data.devices_param[device_id].vendor_id == VENDOR_ID_NV)
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_NV)
{
#if defined(LINUX) && defined(HAVE_NVML)
nvmlUtilization_t utilization;
return -1;
}
+int hm_get_memoryspeed_with_device_id (const uint device_id)
+{
+ if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
+
+ #ifdef HAVE_ADL
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
+ {
+ if (data.hm_amd)
+ {
+ ADLPMActivity PMActivity;
+
+ PMActivity.iSize = sizeof (ADLPMActivity);
+
+ if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
+
+ return PMActivity.iMemoryClock / 100;
+ }
+ }
+ #endif // HAVE_ADL
+
+ return -1;
+}
+
+int hm_get_corespeed_with_device_id (const uint device_id)
+{
+ if ((data.devices_param[device_id].device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
+
+ #ifdef HAVE_ADL
+ if (data.devices_param[device_id].device_vendor_id == VENDOR_ID_AMD)
+ {
+ if (data.hm_amd)
+ {
+ ADLPMActivity PMActivity;
+
+ PMActivity.iSize = sizeof (ADLPMActivity);
+
+ if (hm_ADL_Overdrive_CurrentActivity_Get (data.hm_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
+
+ return PMActivity.iEngineClock / 100;
+ }
+ }
+ #endif // HAVE_ADL
+
+ return -1;
+}
+
#ifdef HAVE_ADL
int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed)
{
case OPTI_TYPE_SINGLE_SALT: return ((char *) OPTI_STR_SINGLE_SALT); break;
case OPTI_TYPE_BRUTE_FORCE: return ((char *) OPTI_STR_BRUTE_FORCE); break;
case OPTI_TYPE_RAW_HASH: return ((char *) OPTI_STR_RAW_HASH); break;
+ case OPTI_TYPE_SLOW_HASH_SIMD: return ((char *) OPTI_STR_SLOW_HASH_SIMD); break;
case OPTI_TYPE_USES_BITS_8: return ((char *) OPTI_STR_USES_BITS_8); break;
case OPTI_TYPE_USES_BITS_16: return ((char *) OPTI_STR_USES_BITS_16); break;
case OPTI_TYPE_USES_BITS_32: return ((char *) OPTI_STR_USES_BITS_32); break;
case 13200: return ((char *) HT_13200); break;
case 13300: return ((char *) HT_13300); break;
case 13400: return ((char *) HT_13400); break;
+ case 13500: return ((char *) HT_13500); break;
+ case 13600: return ((char *) HT_13600); break;
+ case 13711: return ((char *) HT_13711); break;
+ case 13712: return ((char *) HT_13712); break;
+ case 13713: return ((char *) HT_13713); break;
+ case 13721: return ((char *) HT_13721); break;
+ case 13722: return ((char *) HT_13722); break;
+ case 13723: return ((char *) HT_13723); break;
+ case 13731: return ((char *) HT_13731); break;
+ case 13732: return ((char *) HT_13732); break;
+ case 13733: return ((char *) HT_13733); break;
+ case 13741: return ((char *) HT_13741); break;
+ case 13742: return ((char *) HT_13742); break;
+ case 13743: return ((char *) HT_13743); break;
+ case 13751: return ((char *) HT_13751); break;
+ case 13752: return ((char *) HT_13752); break;
+ case 13753: return ((char *) HT_13753); break;
+ case 13761: return ((char *) HT_13761); break;
+ case 13762: return ((char *) HT_13762); break;
+ case 13763: return ((char *) HT_13763); break;
}
return ((char *) "Unknown");
sprintf (ptr_data, "%08x", ptr_keyfile[i]);
}
}
+ else if (hash_mode == 13500)
+ {
+ pstoken_t *pstokens = (pstoken_t *) data.esalts_buf;
+
+ pstoken_t *pstoken = &pstokens[salt_pos];
+
+ const u32 salt_len = (pstoken->salt_len > 512) ? 512 : pstoken->salt_len;
+
+ char pstoken_tmp[1024 + 1] = { 0 };
+
+ for (uint i = 0, j = 0; i < salt_len; i += 1, j += 2)
+ {
+ const u8 *ptr = (const u8 *) pstoken->salt_buf;
+
+ sprintf (pstoken_tmp + j, "%02x", ptr[i]);
+ }
+
+ snprintf (out_buf, len-1, "%08x%08x%08x%08x%08x:%s",
+ digest_buf[0],
+ digest_buf[1],
+ digest_buf[2],
+ digest_buf[3],
+ digest_buf[4],
+ pstoken_tmp);
+ }
+ else if (hash_mode == 13600)
+ {
+ zip2_t *zip2s = (zip2_t *) data.esalts_buf;
+
+ zip2_t *zip2 = &zip2s[salt_pos];
+
+ const u32 salt_len = zip2->salt_len;
+
+ char salt_tmp[32 + 1] = { 0 };
+
+ for (uint i = 0, j = 0; i < salt_len; i += 1, j += 2)
+ {
+ const u8 *ptr = (const u8 *) zip2->salt_buf;
+
+ sprintf (salt_tmp + j, "%02x", ptr[i]);
+ }
+
+ const u32 data_len = zip2->data_len;
+
+ char data_tmp[8192 + 1] = { 0 };
+
+ for (uint i = 0, j = 0; i < data_len; i += 1, j += 2)
+ {
+ const u8 *ptr = (const u8 *) zip2->data_buf;
+
+ sprintf (data_tmp + j, "%02x", ptr[i]);
+ }
+
+ const u32 auth_len = zip2->auth_len;
+
+ char auth_tmp[20 + 1] = { 0 };
+
+ for (uint i = 0, j = 0; i < auth_len; i += 1, j += 2)
+ {
+ const u8 *ptr = (const u8 *) zip2->auth_buf;
+
+ sprintf (auth_tmp + j, "%02x", ptr[i]);
+ }
+
+ snprintf (out_buf, 255, "%s*%u*%u*%u*%s*%x*%u*%s*%s*%s",
+ SIGNATURE_ZIP2_START,
+ zip2->type,
+ zip2->mode,
+ zip2->magic,
+ salt_tmp,
+ zip2->verify_bytes,
+ zip2->compress_length,
+ data_tmp,
+ auth_tmp,
+ SIGNATURE_ZIP2_STOP);
+ }
+ else if ((hash_mode >= 13700) && (hash_mode <= 13799))
+ {
+ snprintf (out_buf, len-1, "%s", hashfile);
+ }
else
{
if (hash_type == HASH_TYPE_MD4)
{
if (data.devices_status == STATUS_PAUSED)
{
- float ms_paused;
+ double ms_paused;
hc_timer_get (data.timer_paused, ms_paused);
fclose (fp);
- char new_cwd[1024] = { 0 };
-
- char *nwd = getcwd (new_cwd, sizeof (new_cwd));
-
- if (nwd == NULL)
- {
- log_error ("Restore file is corrupted");
- }
-
- if (strncmp (new_cwd, rd->cwd, sizeof (new_cwd)) != 0)
- {
- if (getcwd (rd->cwd, sizeof (rd->cwd)) == NULL)
- {
- log_error ("ERROR: could not determine current user path: %s", strerror (errno));
-
- exit (-1);
- }
-
- log_info ("WARNING: Found old restore file, updating path to %s...", new_cwd);
- }
+ log_info ("INFO: Changing current working directory to the path found within the .restore file: '%s'", rd->cwd);
if (chdir (rd->cwd))
{
- log_error ("ERROR: cannot chdir to %s: %s", rd->cwd, strerror (errno));
+ log_error ("ERROR: The directory '%s' does not exist. It is needed to restore (--restore) the session.\n"
+ " You could either create this directory (or link it) or update the .restore file using e.g. the analyze_hc_restore.pl tool:\n"
+ " https://github.com/philsmd/analyze_hc_restore\n"
+ " The directory must be relative to (or contain) all files/folders mentioned within the command line.", rd->cwd);
exit (-1);
}
return (PARSER_OK);
}
+int pstoken_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
+{
+ if ((input_len < DISPLAY_LEN_MIN_13500) || (input_len > DISPLAY_LEN_MAX_13500)) return (PARSER_GLOBAL_LENGTH);
+
+ u32 *digest = (u32 *) hash_buf->digest;
+
+ salt_t *salt = hash_buf->salt;
+
+ pstoken_t *pstoken = (pstoken_t *) hash_buf->esalt;
+
+ digest[0] = hex_to_u32 ((const u8 *) &input_buf[ 0]);
+ digest[1] = hex_to_u32 ((const u8 *) &input_buf[ 8]);
+ digest[2] = hex_to_u32 ((const u8 *) &input_buf[16]);
+ digest[3] = hex_to_u32 ((const u8 *) &input_buf[24]);
+ digest[4] = hex_to_u32 ((const u8 *) &input_buf[32]);
+
+ if (input_buf[40] != data.separator) return (PARSER_SEPARATOR_UNMATCHED);
+
+ uint salt_len = input_len - 40 - 1;
+
+ char *salt_buf = input_buf + 40 + 1;
+
+ if (salt_len == UINT_MAX || salt_len % 2 != 0) return (PARSER_SALT_LENGTH);
+
+ u8 *pstoken_ptr = (u8 *) pstoken->salt_buf;
+
+ for (uint i = 0, j = 0; i < salt_len; i += 2, j += 1)
+ {
+ pstoken_ptr[j] = hex_to_u8 ((const u8 *) &salt_buf[i]);
+ }
+
+ pstoken->salt_len = salt_len / 2;
+
+ /* some fake salt for the sorting mechanisms */
+
+ salt->salt_buf[0] = pstoken->salt_buf[0];
+ salt->salt_buf[1] = pstoken->salt_buf[1];
+ salt->salt_buf[2] = pstoken->salt_buf[2];
+ salt->salt_buf[3] = pstoken->salt_buf[3];
+ salt->salt_buf[4] = pstoken->salt_buf[4];
+ salt->salt_buf[5] = pstoken->salt_buf[5];
+ salt->salt_buf[6] = pstoken->salt_buf[6];
+ salt->salt_buf[7] = pstoken->salt_buf[7];
+
+ salt->salt_len = 32;
+
+ /* we need to check if we can precompute some of the data --
+ this is possible since the scheme is badly designed */
+
+ pstoken->pc_digest[0] = SHA1M_A;
+ pstoken->pc_digest[1] = SHA1M_B;
+ pstoken->pc_digest[2] = SHA1M_C;
+ pstoken->pc_digest[3] = SHA1M_D;
+ pstoken->pc_digest[4] = SHA1M_E;
+
+ pstoken->pc_offset = 0;
+
+ for (int i = 0; i < (int) pstoken->salt_len - 64; i += 64)
+ {
+ uint w[16];
+
+ w[ 0] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 0]);
+ w[ 1] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 1]);
+ w[ 2] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 2]);
+ w[ 3] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 3]);
+ w[ 4] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 4]);
+ w[ 5] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 5]);
+ w[ 6] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 6]);
+ w[ 7] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 7]);
+ w[ 8] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 8]);
+ w[ 9] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 9]);
+ w[10] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 10]);
+ w[11] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 11]);
+ w[12] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 12]);
+ w[13] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 13]);
+ w[14] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 14]);
+ w[15] = byte_swap_32 (pstoken->salt_buf[pstoken->pc_offset + 15]);
+
+ sha1_64 (w, pstoken->pc_digest);
+
+ pstoken->pc_offset += 16;
+ }
+
+ return (PARSER_OK);
+}
+
int sha1b64_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
{
if ((input_len < DISPLAY_LEN_MIN_101) || (input_len > DISPLAY_LEN_MAX_101)) return (PARSER_GLOBAL_LENGTH);
salt->salt_len = 4;
- salt->salt_iter = 1000 - 1;
+ salt->salt_iter = ROUNDS_TRUECRYPT_1K - 1;
+
+ tc->signature = 0x45555254; // "TRUE"
digest[0] = tc->data_buf[0];
salt->salt_len = 4;
- salt->salt_iter = 2000 - 1;
+ salt->salt_iter = ROUNDS_TRUECRYPT_2K - 1;
+
+ tc->signature = 0x45555254; // "TRUE"
+
+ digest[0] = tc->data_buf[0];
+
+ return (PARSER_OK);
+}
+
+int veracrypt_parse_hash_200000 (char *input_buf, uint input_len, hash_t *hash_buf)
+{
+ u32 *digest = (u32 *) hash_buf->digest;
+
+ salt_t *salt = hash_buf->salt;
+
+ tc_t *tc = (tc_t *) hash_buf->esalt;
+
+ if (input_len == 0)
+ {
+ log_error ("VeraCrypt container not specified");
+
+ exit (-1);
+ }
+
+ FILE *fp = fopen (input_buf, "rb");
+
+ if (fp == NULL)
+ {
+ log_error ("%s: %s", input_buf, strerror (errno));
+
+ exit (-1);
+ }
+
+ char buf[512] = { 0 };
+
+ int n = fread (buf, 1, sizeof (buf), fp);
+
+ fclose (fp);
+
+ if (n != 512) return (PARSER_VC_FILE_SIZE);
+
+ memcpy (tc->salt_buf, buf, 64);
+
+ memcpy (tc->data_buf, buf + 64, 512 - 64);
+
+ salt->salt_buf[0] = tc->salt_buf[0];
+
+ salt->salt_len = 4;
+
+ salt->salt_iter = ROUNDS_VERACRYPT_200000 - 1;
+
+ tc->signature = 0x41524556; // "VERA"
+
+ digest[0] = tc->data_buf[0];
+
+ return (PARSER_OK);
+}
+
+int veracrypt_parse_hash_500000 (char *input_buf, uint input_len, hash_t *hash_buf)
+{
+ u32 *digest = (u32 *) hash_buf->digest;
+
+ salt_t *salt = hash_buf->salt;
+
+ tc_t *tc = (tc_t *) hash_buf->esalt;
+
+ if (input_len == 0)
+ {
+ log_error ("VeraCrypt container not specified");
+
+ exit (-1);
+ }
+
+ FILE *fp = fopen (input_buf, "rb");
+
+ if (fp == NULL)
+ {
+ log_error ("%s: %s", input_buf, strerror (errno));
+
+ exit (-1);
+ }
+
+ char buf[512] = { 0 };
+
+ int n = fread (buf, 1, sizeof (buf), fp);
+
+ fclose (fp);
+
+ if (n != 512) return (PARSER_VC_FILE_SIZE);
+
+ memcpy (tc->salt_buf, buf, 64);
+
+ memcpy (tc->data_buf, buf + 64, 512 - 64);
+
+ salt->salt_buf[0] = tc->salt_buf[0];
+
+ salt->salt_len = 4;
+
+ salt->salt_iter = ROUNDS_VERACRYPT_500000 - 1;
+
+ tc->signature = 0x41524556; // "VERA"
+
+ digest[0] = tc->data_buf[0];
+
+ return (PARSER_OK);
+}
+
+int veracrypt_parse_hash_327661 (char *input_buf, uint input_len, hash_t *hash_buf)
+{
+ u32 *digest = (u32 *) hash_buf->digest;
+
+ salt_t *salt = hash_buf->salt;
+
+ tc_t *tc = (tc_t *) hash_buf->esalt;
+
+ if (input_len == 0)
+ {
+ log_error ("VeraCrypt container not specified");
+
+ exit (-1);
+ }
+
+ FILE *fp = fopen (input_buf, "rb");
+
+ if (fp == NULL)
+ {
+ log_error ("%s: %s", input_buf, strerror (errno));
+
+ exit (-1);
+ }
+
+ char buf[512] = { 0 };
+
+ int n = fread (buf, 1, sizeof (buf), fp);
+
+ fclose (fp);
+
+ if (n != 512) return (PARSER_VC_FILE_SIZE);
+
+ memcpy (tc->salt_buf, buf, 64);
+
+ memcpy (tc->data_buf, buf + 64, 512 - 64);
+
+ salt->salt_buf[0] = tc->salt_buf[0];
+
+ salt->salt_len = 4;
+
+ salt->salt_iter = ROUNDS_VERACRYPT_327661 - 1;
+
+ tc->signature = 0x41524556; // "VERA"
+
+ digest[0] = tc->data_buf[0];
+
+ return (PARSER_OK);
+}
+
+int veracrypt_parse_hash_655331 (char *input_buf, uint input_len, hash_t *hash_buf)
+{
+ u32 *digest = (u32 *) hash_buf->digest;
+
+ salt_t *salt = hash_buf->salt;
+
+ tc_t *tc = (tc_t *) hash_buf->esalt;
+
+ if (input_len == 0)
+ {
+ log_error ("VeraCrypt container not specified");
+
+ exit (-1);
+ }
+
+ FILE *fp = fopen (input_buf, "rb");
+
+ if (fp == NULL)
+ {
+ log_error ("%s: %s", input_buf, strerror (errno));
+
+ exit (-1);
+ }
+
+ char buf[512] = { 0 };
+
+ int n = fread (buf, 1, sizeof (buf), fp);
+
+ fclose (fp);
+
+ if (n != 512) return (PARSER_VC_FILE_SIZE);
+
+ memcpy (tc->salt_buf, buf, 64);
+
+ memcpy (tc->data_buf, buf + 64, 512 - 64);
+
+ salt->salt_buf[0] = tc->salt_buf[0];
+
+ salt->salt_len = 4;
+
+ salt->salt_iter = ROUNDS_VERACRYPT_655331 - 1;
+
+ tc->signature = 0x41524556; // "VERA"
digest[0] = tc->data_buf[0];
return (PARSER_OK);
}
+int zip2_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf)
+{
+ if ((input_len < DISPLAY_LEN_MIN_13600) || (input_len > DISPLAY_LEN_MAX_13600)) return (PARSER_GLOBAL_LENGTH);
+
+ if (memcmp (SIGNATURE_ZIP2_START, input_buf , 6)) return (PARSER_SIGNATURE_UNMATCHED);
+ if (memcmp (SIGNATURE_ZIP2_STOP , input_buf + input_len - 7, 7)) return (PARSER_SIGNATURE_UNMATCHED);
+
+ u32 *digest = (u32 *) hash_buf->digest;
+
+ salt_t *salt = hash_buf->salt;
+
+ zip2_t *zip2 = (zip2_t *) hash_buf->esalt;
+
+ /**
+ * parse line
+ */
+
+ char *param0_pos = input_buf + 6 + 1;
+
+ char *param1_pos = strchr (param0_pos, '*');
+
+ if (param1_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
+
+ u32 param0_len = param1_pos - param0_pos;
+
+ param1_pos++;
+
+ char *param2_pos = strchr (param1_pos, '*');
+
+ if (param2_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
+
+ u32 param1_len = param2_pos - param1_pos;
+
+ param2_pos++;
+
+ char *param3_pos = strchr (param2_pos, '*');
+
+ if (param3_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
+
+ u32 param2_len = param3_pos - param2_pos;
+
+ param3_pos++;
+
+ char *param4_pos = strchr (param3_pos, '*');
+
+ if (param4_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
+
+ u32 param3_len = param4_pos - param3_pos;
+
+ param4_pos++;
+
+ char *param5_pos = strchr (param4_pos, '*');
+
+ if (param5_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
+
+ u32 param4_len = param5_pos - param4_pos;
+
+ param5_pos++;
+
+ char *param6_pos = strchr (param5_pos, '*');
+
+ if (param6_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
+
+ u32 param5_len = param6_pos - param5_pos;
+
+ param6_pos++;
+
+ char *param7_pos = strchr (param6_pos, '*');
+
+ if (param7_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
+
+ u32 param6_len = param7_pos - param6_pos;
+
+ param7_pos++;
+
+ char *param8_pos = strchr (param7_pos, '*');
+
+ if (param8_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);
+
+ u32 param7_len = param8_pos - param7_pos;
+
+ param8_pos++;
+
+ const uint type = atoi (param0_pos);
+ const uint mode = atoi (param1_pos);
+ const uint magic = atoi (param2_pos);
+
+ char *salt_buf = param3_pos;
+
+ uint verify_bytes; sscanf (param4_pos, "%4x*", &verify_bytes);
+
+ const uint compress_length = atoi (param5_pos);
+
+ char *data_buf = param6_pos;
+ char *auth = param7_pos;
+
+ /**
+ * verify some data
+ */
+
+ if (param0_len != 1) return (PARSER_SALT_VALUE);
+
+ if (param1_len != 1) return (PARSER_SALT_VALUE);
+
+ if (param2_len != 1) return (PARSER_SALT_VALUE);
+
+ if ((param3_len != 16) && (param3_len != 24) && (param3_len != 32)) return (PARSER_SALT_VALUE);
+
+ if (param4_len >= 5) return (PARSER_SALT_VALUE);
+
+ if (param5_len >= 5) return (PARSER_SALT_VALUE);
+
+ if (param6_len >= 8192) return (PARSER_SALT_VALUE);
+
+ if (param6_len & 1) return (PARSER_SALT_VALUE);
+
+ if (param7_len != 20) return (PARSER_SALT_VALUE);
+
+ if (type != 0) return (PARSER_SALT_VALUE);
+
+ if ((mode != 1) && (mode != 2) && (mode != 3)) return (PARSER_SALT_VALUE);
+
+ if (magic != 0) return (PARSER_SALT_VALUE);
+
+ if (verify_bytes >= 0x10000) return (PARSER_SALT_VALUE);
+
+ /**
+ * store data
+ */
+
+ zip2->type = type;
+ zip2->mode = mode;
+ zip2->magic = magic;
+
+ if (mode == 1)
+ {
+ zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_buf[ 0]);
+ zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_buf[ 8]);
+ zip2->salt_buf[2] = 0;
+ zip2->salt_buf[3] = 0;
+
+ zip2->salt_len = 8;
+ }
+ else if (mode == 2)
+ {
+ zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_buf[ 0]);
+ zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_buf[ 8]);
+ zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_buf[16]);
+ zip2->salt_buf[3] = 0;
+
+ zip2->salt_len = 12;
+ }
+ else if (mode == 3)
+ {
+ zip2->salt_buf[0] = hex_to_u32 ((const u8 *) &salt_buf[ 0]);
+ zip2->salt_buf[1] = hex_to_u32 ((const u8 *) &salt_buf[ 8]);
+ zip2->salt_buf[2] = hex_to_u32 ((const u8 *) &salt_buf[16]);
+ zip2->salt_buf[3] = hex_to_u32 ((const u8 *) &salt_buf[24]);
+
+ zip2->salt_len = 16;
+ }
+
+ zip2->salt_buf[0] = byte_swap_32 (zip2->salt_buf[0]);
+ zip2->salt_buf[1] = byte_swap_32 (zip2->salt_buf[1]);
+ zip2->salt_buf[2] = byte_swap_32 (zip2->salt_buf[2]);
+ zip2->salt_buf[3] = byte_swap_32 (zip2->salt_buf[3]);
+
+ zip2->verify_bytes = verify_bytes;
+
+ zip2->compress_length = compress_length;
+
+ char *data_buf_ptr = (char *) zip2->data_buf;
+
+ for (uint i = 0; i < param6_len; i += 2)
+ {
+ const char p0 = data_buf[i + 0];
+ const char p1 = data_buf[i + 1];
+
+ *data_buf_ptr++ = hex_convert (p1) << 0
+ | hex_convert (p0) << 4;
+
+ zip2->data_len++;
+ }
+
+ *data_buf_ptr = 0x80;
+
+ char *auth_ptr = (char *) zip2->auth_buf;
+
+ for (uint i = 0; i < param7_len; i += 2)
+ {
+ const char p0 = auth[i + 0];
+ const char p1 = auth[i + 1];
+
+ *auth_ptr++ = hex_convert (p1) << 0
+ | hex_convert (p0) << 4;
+
+ zip2->auth_len++;
+ }
+
+ /**
+ * salt buf (fake)
+ */
+
+ salt->salt_buf[0] = zip2->salt_buf[0];
+ salt->salt_buf[1] = zip2->salt_buf[1];
+ salt->salt_buf[2] = zip2->salt_buf[2];
+ salt->salt_buf[3] = zip2->salt_buf[3];
+ salt->salt_buf[4] = zip2->data_buf[0];
+ salt->salt_buf[5] = zip2->data_buf[1];
+ salt->salt_buf[6] = zip2->data_buf[2];
+ salt->salt_buf[7] = zip2->data_buf[3];
+
+ salt->salt_len = 32;
+
+ salt->salt_iter = ROUNDS_ZIP2 - 1;
+
+ /**
+ * digest buf (fake)
+ */
+
+ digest[0] = zip2->auth_buf[0];
+ digest[1] = zip2->auth_buf[1];
+ digest[2] = zip2->auth_buf[2];
+ digest[3] = zip2->auth_buf[3];
+
+ return (PARSER_OK);
+}
+
/**
* parallel running threads
*/
if (ch == 0) continue;
- #ifdef _POSIX
- if (ch != '\n')
- #endif
+ //https://github.com/hashcat/hashcat/issues/302
+ //#ifdef _POSIX
+ //if (ch != '\n')
+ //#endif
hc_thread_mutex_lock (mux_display);
switch (ch)
{
case 's':
+ case '\r':
case '\n':
log_info ("");
break;
}
+ //https://github.com/hashcat/hashcat/issues/302
+ //#ifdef _POSIX
+ //if (ch != '\n')
+ //#endif
+
hc_thread_mutex_unlock (mux_display);
}