Do not automatically enable powertune in benchmark, but allow the user to enable...
[hashcat.git] / src / hashcat.c
index de54214..4405789 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);  \
@@ -3400,7 +3402,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
@@ -5446,8 +5451,25 @@ void SetConsoleWindowSize (const int x)
 }
 #endif
 
+#ifdef _POSIX
+int (*clock_gettime_orig) (clockid_t clk_id, struct timespec *tp);
+
+int clock_gettime (clockid_t clk_id, struct timespec *tp)
+{
+  int r = clock_gettime_orig (clk_id, tp);
+
+  usleep (NVIDIA_100PERCENTCPU_WORKAROUND);
+
+  return r;
+}
+#endif
+
 int main (int argc, char **argv)
 {
+  #ifdef _POSIX
+  clock_gettime_orig = dlsym (RTLD_NEXT, "clock_gettime");
+  #endif
+
   #ifdef _WIN
   SetConsoleWindowSize (132);
   #endif
@@ -6089,6 +6111,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 +6972,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;
@@ -18274,4 +18302,3 @@ int main (int argc, char **argv)
 
   return -1;
 }
-