Move macros DGST_R0 - DGST_R3 to host, define dgst_size for opencl kernel from host...
[hashcat.git] / OpenCL / m12500.cl
index 3292bc1..2f00e56 100644 (file)
@@ -7,21 +7,15 @@
 
 #define _RAR3_
 
-#include "include/constants.h"
-#include "include/kernel_vendor.h"
+#include "inc_vendor.cl"
+#include "inc_hash_constants.h"
+#include "inc_hash_functions.cl"
 
-#define DGST_R0 0
-#define DGST_R1 1
-#define DGST_R2 2
-#define DGST_R3 3
+#include "inc_types.cl"
+#include "inc_common.cl"
 
-#include "include/kernel_functions.c"
-
-#include "OpenCL/types_ocl.c"
-#include "OpenCL/common.c"
-
-#define COMPARE_S "OpenCL/check_single_comp4.c"
-#define COMPARE_M "OpenCL/check_multi_comp4.c"
+#define COMPARE_S "inc_comp_single.cl"
+#define COMPARE_M "inc_comp_multi.cl"
 
 #define ROUNDS 0x40000
 
@@ -31,6 +25,8 @@
 #define PUTCHAR_BE(a,p,c) ((u8 *)(a))[(p) ^ 3] = (u8) (c)
 #define GETCHAR_BE(a,p)   ((u8 *)(a))[(p) ^ 3]
 
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+
 __constant u32 te0[256] =
 {
   0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d,
@@ -1017,7 +1013,7 @@ __kernel void m12500_loop (__global pw_t *pws, __global kernel_rule_t *rules_buf
   pw_buf[3] = pws[gid].i[3];
   pw_buf[4] = pws[gid].i[4];
 
-  const u32 pw_len = pws[gid].pw_len;
+  const u32 pw_len = MIN (pws[gid].pw_len, 20);
 
   u32 salt_buf[2];
 
@@ -1150,7 +1146,7 @@ __kernel void m12500_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf
    * base
    */
 
-  const u32 pw_len = pws[gid].pw_len;
+  const u32 pw_len = MIN (pws[gid].pw_len, 20);
 
   const u32 salt_len = 8;
 
@@ -1226,16 +1222,16 @@ __kernel void m12500_comp (__global pw_t *pws, __global kernel_rule_t *rules_buf
     pw_buf[3] = pws[gid].i[3];
     pw_buf[4] = pws[gid].i[4];
 
-    const u32 pw_len = pws[gid].pw_len;
+    //const u32 pw_len = pws[gid].pw_len;
 
     u32 salt_buf[2];
 
     salt_buf[0] = salt_bufs[salt_pos].salt_buf[0];
     salt_buf[1] = salt_bufs[salt_pos].salt_buf[1];
 
-    const u32 salt_len = 8;
+    //const u32 salt_len = 8;
 
-    const u32 p3 = (pw_len * 2) + salt_len + 3;
+    //const u32 p3 = (pw_len * 2) + salt_len + 3;
 
     u32 w[16];