Simple, but effective workaround to solve the 100% CPU burning loop bug in Nvidias...
[hashcat.git] / src / hashcat.c
index f74ce20..4f6ee58 100644 (file)
@@ -150,6 +150,8 @@ double TARGET_MS_PROFILE[4]     = { 2, 12, 96, 480 };
 
 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
 
+#define NVIDIA_100PERCENTCPU_WORKAROUND 100
+
 #define global_free(attr)       \
 {                               \
   myfree ((void *) data.attr);  \
@@ -2466,6 +2468,11 @@ static void run_kernel (const uint kern_run, hc_device_param_t *device_param, co
 
   hc_clFlush (data.ocl, device_param->command_queue);
 
+  if (data.devices_status == STATUS_RUNNING)
+  {
+    usleep (device_param->exec_prev * 1000);
+  }
+
   hc_clWaitForEvents (data.ocl, 1, &event);
 
   if (event_update)
@@ -2482,6 +2489,8 @@ static void run_kernel (const uint kern_run, hc_device_param_t *device_param, co
 
     device_param->exec_ms[exec_pos] = exec_time;
 
+    device_param->exec_prev = exec_time;
+
     exec_pos++;
 
     if (exec_pos == EXEC_CACHE)
@@ -3400,7 +3409,10 @@ static void run_cracker (hc_device_param_t *device_param, const uint pws_cnt)
        * result
        */
 
-      check_cracked (device_param, salt_pos);
+      if (data.benchmark == 0)
+      {
+        check_cracked (device_param, salt_pos);
+      }
 
       /**
        * progress
@@ -5420,7 +5432,7 @@ static uint generate_bitmaps (const uint digests_cnt, const uint dgst_size, cons
  * main
  */
 
-#ifdef _WIN
+#ifdef WIN
 void SetConsoleWindowSize (const int x)
 {
   HANDLE h = GetStdHandle (STD_OUTPUT_HANDLE);
@@ -5448,7 +5460,7 @@ void SetConsoleWindowSize (const int x)
 
 int main (int argc, char **argv)
 {
-  #ifdef _WIN
+  #ifdef WIN
   SetConsoleWindowSize (132);
   #endif
 
@@ -6089,6 +6101,9 @@ int main (int argc, char **argv)
       {
         log_info ("%s (%s) starting in benchmark-mode...", PROGNAME, VERSION_TAG);
         log_info ("");
+        log_info ("Note: Reported benchmark cracking speed = real cracking speed");
+        log_info ("To verify, run hashcat like this: only_one_hash.txt -a 3 -w 3 ?b?b?b?b?b?b?b");
+        log_info ("");
       }
       else
       {
@@ -6947,7 +6962,10 @@ int main (int argc, char **argv)
     gpu_temp_disable      = 1;
 
     #ifdef HAVE_HWMON
-    powertune_enable      = 1;
+    if (powertune_enable == 1)
+    {
+      gpu_temp_disable = 0;
+    }
     #endif
 
     data.status_timer     = status_timer;
@@ -11278,7 +11296,7 @@ int main (int argc, char **argv)
                   break;
       case  7400: if (pw_max > 16) pw_max = 16;
                   break;
-      case  7500: if (pw_max >  8) pw_max =  8;
+      case  7700: if (pw_max >  8) pw_max =  8;
                   break;
       case  7900: if (pw_max > 48) pw_max = 48;
                   break;
@@ -18274,4 +18292,3 @@ int main (int argc, char **argv)
 
   return -1;
 }
-