Merge pull request #333 from y0sh1/CreateTravisBuilds
[hashcat.git] / OpenCL / m08600_a3.cl
index 6a307a4..5b7d924 100644 (file)
@@ -71,7 +71,7 @@ __constant u32 lotus_magic_table[256] =
 #define BOX1(S,i) (u32x) ((S)[(i).s0], (S)[(i).s1], (S)[(i).s2], (S)[(i).s3], (S)[(i).s4], (S)[(i).s5], (S)[(i).s6], (S)[(i).s7], (S)[(i).s8], (S)[(i).s9], (S)[(i).sa], (S)[(i).sb], (S)[(i).sc], (S)[(i).sd], (S)[(i).se], (S)[(i).sf])
 #endif
 
-static void lotus_mix (u32x *in, __local u32 *s_lotus_magic_table)
+void lotus_mix (u32x *in, __local u32 *s_lotus_magic_table)
 {
   u32x p = 0;
 
@@ -79,7 +79,9 @@ static void lotus_mix (u32x *in, __local u32 *s_lotus_magic_table)
   {
     u32 s = 48;
 
-    #pragma unroll 12
+    #ifdef _unroll
+    #pragma unroll
+    #endif
     for (int j = 0; j < 12; j++)
     {
       u32x tmp_in = in[j];
@@ -95,13 +97,15 @@ static void lotus_mix (u32x *in, __local u32 *s_lotus_magic_table)
   }
 }
 
-static void lotus_transform_password (u32x in[4], u32x out[4], __local u32 *s_lotus_magic_table)
+void lotus_transform_password (u32x in[4], u32x out[4], __local u32 *s_lotus_magic_table)
 {
   u32x t = out[3] >> 24;
 
   u32x c;
 
-  #pragma unroll 4
+  #ifdef _unroll
+  #pragma unroll
+  #endif
   for (int i = 0; i < 4; i++)
   {
     t ^= (in[i] >>  0) & 0xff; c = BOX1 (s_lotus_magic_table, t); out[i] ^= c <<  0; t = ((out[i] >>  0) & 0xff);
@@ -111,7 +115,7 @@ static void lotus_transform_password (u32x in[4], u32x out[4], __local u32 *s_lo
   }
 }
 
-static void pad (u32 w[4], const u32 len)
+void pad (u32 w[4], const u32 len)
 {
   const u32 val = 16 - len;
 
@@ -190,7 +194,7 @@ static void pad (u32 w[4], const u32 len)
   }
 }
 
-static void mdtransform_norecalc (u32x state[4], u32x block[4], __local u32 *s_lotus_magic_table)
+void mdtransform_norecalc (u32x state[4], u32x block[4], __local u32 *s_lotus_magic_table)
 {
   u32x x[12];
 
@@ -215,14 +219,14 @@ static void mdtransform_norecalc (u32x state[4], u32x block[4], __local u32 *s_l
   state[3] = x[3];
 }
 
-static void mdtransform (u32x state[4], u32x checksum[4], u32x block[4], __local u32 *s_lotus_magic_table)
+void mdtransform (u32x state[4], u32x checksum[4], u32x block[4], __local u32 *s_lotus_magic_table)
 {
   mdtransform_norecalc (state, block, s_lotus_magic_table);
 
   lotus_transform_password (block, checksum, s_lotus_magic_table);
 }
 
-static void domino_big_md (const u32x saved_key[16], const u32x size, u32x state[4], __local u32 *s_lotus_magic_table)
+void domino_big_md (const u32x saved_key[16], const u32x size, u32x state[4], __local u32 *s_lotus_magic_table)
 {
   u32x checksum[4];
 
@@ -243,7 +247,7 @@ static void domino_big_md (const u32x saved_key[16], const u32x size, u32x state
   mdtransform_norecalc (state, checksum, s_lotus_magic_table);
 }
 
-static void m08600m (__local u32 *s_lotus_magic_table, u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset)
+void m08600m (__local u32 *s_lotus_magic_table, u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset)
 {
   /**
    * modifier
@@ -253,7 +257,7 @@ static void m08600m (__local u32 *s_lotus_magic_table, u32 w[16], const u32 pw_l
   const u32 lid = get_local_id (0);
 
   /**
-   * padding
+   * base
    */
 
   if (pw_len < 16)
@@ -283,26 +287,26 @@ static void m08600m (__local u32 *s_lotus_magic_table, u32 w[16], const u32 pw_l
   {
     const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
 
-    const u32x w0 = w0l | w0r;
-
-    u32x w_tmp[16];
-
-    w_tmp[ 0] = w0;
-    w_tmp[ 1] = w[ 1];
-    w_tmp[ 2] = w[ 2];
-    w_tmp[ 3] = w[ 3];
-    w_tmp[ 4] = w[ 4];
-    w_tmp[ 5] = w[ 5];
-    w_tmp[ 6] = w[ 6];
-    w_tmp[ 7] = w[ 7];
-    w_tmp[ 8] = w[ 8];
-    w_tmp[ 9] = w[ 9];
-    w_tmp[10] = w[10];
-    w_tmp[11] = w[11];
-    w_tmp[12] = w[12];
-    w_tmp[13] = w[13];
-    w_tmp[14] = w[14];
-    w_tmp[15] = w[15];
+    const u32x w0lr = w0l | w0r;
+
+    u32x w_t[16];
+
+    w_t[ 0] = w0lr;
+    w_t[ 1] = w[ 1];
+    w_t[ 2] = w[ 2];
+    w_t[ 3] = w[ 3];
+    w_t[ 4] = w[ 4];
+    w_t[ 5] = w[ 5];
+    w_t[ 6] = w[ 6];
+    w_t[ 7] = w[ 7];
+    w_t[ 8] = w[ 8];
+    w_t[ 9] = w[ 9];
+    w_t[10] = w[10];
+    w_t[11] = w[11];
+    w_t[12] = w[12];
+    w_t[13] = w[13];
+    w_t[14] = w[14];
+    w_t[15] = w[15];
 
     u32x state[4];
 
@@ -311,13 +315,13 @@ static void m08600m (__local u32 *s_lotus_magic_table, u32 w[16], const u32 pw_l
     state[2] = 0;
     state[3] = 0;
 
-    domino_big_md (w_tmp, pw_len, state, s_lotus_magic_table);
+    domino_big_md (w_t, pw_len, state, s_lotus_magic_table);
 
     COMPARE_M_SIMD (state[0], state[1], state[2], state[3]);
   }
 }
 
-static void m08600s (__local u32 *s_lotus_magic_table, u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset)
+void m08600s (__local u32 *s_lotus_magic_table, u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset)
 {
   /**
    * modifier
@@ -369,26 +373,26 @@ static void m08600s (__local u32 *s_lotus_magic_table, u32 w[16], const u32 pw_l
   {
     const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
 
-    const u32x w0 = w0l | w0r;
-
-    u32x w_tmp[16];
-
-    w_tmp[ 0] = w0;
-    w_tmp[ 1] = w[ 1];
-    w_tmp[ 2] = w[ 2];
-    w_tmp[ 3] = w[ 3];
-    w_tmp[ 4] = w[ 4];
-    w_tmp[ 5] = w[ 5];
-    w_tmp[ 6] = w[ 6];
-    w_tmp[ 7] = w[ 7];
-    w_tmp[ 8] = w[ 8];
-    w_tmp[ 9] = w[ 9];
-    w_tmp[10] = w[10];
-    w_tmp[11] = w[11];
-    w_tmp[12] = w[12];
-    w_tmp[13] = w[13];
-    w_tmp[14] = w[14];
-    w_tmp[15] = w[15];
+    const u32x w0lr = w0l | w0r;
+
+    u32x w_t[16];
+
+    w_t[ 0] = w0lr;
+    w_t[ 1] = w[ 1];
+    w_t[ 2] = w[ 2];
+    w_t[ 3] = w[ 3];
+    w_t[ 4] = w[ 4];
+    w_t[ 5] = w[ 5];
+    w_t[ 6] = w[ 6];
+    w_t[ 7] = w[ 7];
+    w_t[ 8] = w[ 8];
+    w_t[ 9] = w[ 9];
+    w_t[10] = w[10];
+    w_t[11] = w[11];
+    w_t[12] = w[12];
+    w_t[13] = w[13];
+    w_t[14] = w[14];
+    w_t[15] = w[15];
 
     u32x state[4];
 
@@ -397,7 +401,7 @@ static void m08600s (__local u32 *s_lotus_magic_table, u32 w[16], const u32 pw_l
     state[2] = 0;
     state[3] = 0;
 
-    domino_big_md (w_tmp, pw_len, state, s_lotus_magic_table);
+    domino_big_md (w_t, pw_len, state, s_lotus_magic_table);
 
     COMPARE_S_SIMD (state[0], state[1], state[2], state[3]);
   }