Fix m 60 a 0 by making modified variable non-const
[hashcat.git] / OpenCL / m13300_a1.cl
1 /**
2  * Authors......: Jens Steube <jens.steube@gmail.com>
3  * Authors......: Fist0urs   <eddy.maaalou@gmail.com>
4  *
5  * License.....: MIT
6  */
7
8 #define _SHA1_
9
10 #define NEW_SIMD_CODE
11
12 #include "inc_vendor.cl"
13 #include "inc_hash_constants.h"
14 #include "inc_hash_functions.cl"
15 #include "inc_types.cl"
16 #include "inc_common.cl"
17 #include "inc_simd.cl"
18
19 __kernel void m13300_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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, const u32 combs_mode, const u32 gid_max)
20 {
21   /**
22    * modifier
23    */
24
25   const u32 lid = get_local_id (0);
26
27   /**
28    * base
29    */
30
31   const u32 gid = get_global_id (0);
32
33   if (gid >= gid_max) return;
34
35   u32 pw_buf0[4];
36   u32 pw_buf1[4];
37
38   pw_buf0[0] = pws[gid].i[0];
39   pw_buf0[1] = pws[gid].i[1];
40   pw_buf0[2] = pws[gid].i[2];
41   pw_buf0[3] = pws[gid].i[3];
42   pw_buf1[0] = pws[gid].i[4];
43   pw_buf1[1] = pws[gid].i[5];
44   pw_buf1[2] = pws[gid].i[6];
45   pw_buf1[3] = pws[gid].i[7];
46
47   const u32 pw_l_len = pws[gid].pw_len;
48
49   /**
50    * loop
51    */
52
53   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
54   {
55     const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
56
57     const u32x pw_len = pw_l_len + pw_r_len;
58
59     /**
60      * concat password candidate
61      */
62
63     u32x wordl0[4] = { 0 };
64     u32x wordl1[4] = { 0 };
65     u32x wordl2[4] = { 0 };
66     u32x wordl3[4] = { 0 };
67
68     wordl0[0] = pw_buf0[0];
69     wordl0[1] = pw_buf0[1];
70     wordl0[2] = pw_buf0[2];
71     wordl0[3] = pw_buf0[3];
72     wordl1[0] = pw_buf1[0];
73     wordl1[1] = pw_buf1[1];
74     wordl1[2] = pw_buf1[2];
75     wordl1[3] = pw_buf1[3];
76
77     u32x wordr0[4] = { 0 };
78     u32x wordr1[4] = { 0 };
79     u32x wordr2[4] = { 0 };
80     u32x wordr3[4] = { 0 };
81
82     wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
83     wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
84     wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
85     wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
86     wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
87     wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
88     wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
89     wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
90
91     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
92     {
93       switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
94     }
95     else
96     {
97       switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
98     }
99
100     u32x w0[4];
101     u32x w1[4];
102     u32x w2[4];
103     u32x w3[4];
104
105     w0[0] = wordl0[0] | wordr0[0];
106     w0[1] = wordl0[1] | wordr0[1];
107     w0[2] = wordl0[2] | wordr0[2];
108     w0[3] = wordl0[3] | wordr0[3];
109     w1[0] = wordl1[0] | wordr1[0];
110     w1[1] = wordl1[1] | wordr1[1];
111     w1[2] = wordl1[2] | wordr1[2];
112     w1[3] = wordl1[3] | wordr1[3];
113     w2[0] = wordl2[0] | wordr2[0];
114     w2[1] = wordl2[1] | wordr2[1];
115     w2[2] = wordl2[2] | wordr2[2];
116     w2[3] = wordl2[3] | wordr2[3];
117     w3[0] = wordl3[0] | wordr3[0];
118     w3[1] = wordl3[1] | wordr3[1];
119     w3[2] = wordl3[2] | wordr3[2];
120     w3[3] = wordl3[3] | wordr3[3];
121
122     /**
123      * sha1
124      */
125
126     u32x w0_t = swap32 (w0[0]);
127     u32x w1_t = swap32 (w0[1]);
128     u32x w2_t = swap32 (w0[2]);
129     u32x w3_t = swap32 (w0[3]);
130     u32x w4_t = swap32 (w1[0]);
131     u32x w5_t = swap32 (w1[1]);
132     u32x w6_t = swap32 (w1[2]);
133     u32x w7_t = swap32 (w1[3]);
134     u32x w8_t = swap32 (w2[0]);
135     u32x w9_t = swap32 (w2[1]);
136     u32x wa_t = swap32 (w2[2]);
137     u32x wb_t = swap32 (w2[3]);
138     u32x wc_t = swap32 (w3[0]);
139     u32x wd_t = swap32 (w3[1]);
140     u32x we_t = 0;
141     u32x wf_t = pw_len * 8;
142
143     u32x a = SHA1M_A;
144     u32x b = SHA1M_B;
145     u32x c = SHA1M_C;
146     u32x d = SHA1M_D;
147     u32x e = SHA1M_E;
148
149     #undef K
150     #define K SHA1C00
151
152     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
153     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
154     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
155     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
156     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
157     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
158     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
159     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
160     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
161     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
162     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
163     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
164     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
165     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
166     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
167     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
168     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
169     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
170     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
171     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
172
173     #undef K
174     #define K SHA1C01
175
176     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
177     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
178     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
179     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
180     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
181     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
182     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
183     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
184     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
185     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
186     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
187     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
188     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
189     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
190     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
191     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
192     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
193     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
194     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
195     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
196
197     #undef K
198     #define K SHA1C02
199
200     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
201     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
202     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
203     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
204     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
205     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
206     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
207     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
208     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
209     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
210     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
211     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
212     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
213     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
214     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
215     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
216     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
217     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
218     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
219     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
220
221     #undef K
222     #define K SHA1C03
223
224     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
225     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
226     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
227     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
228     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
229     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
230     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
231     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
232     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
233     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
234     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
235     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
236     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
237     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
238     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
239     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
240     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
241     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
242     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
243     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
244
245     a += SHA1M_A;
246     e += SHA1M_E;
247     d += SHA1M_D;
248     c += SHA1M_C;
249
250     e &= 0x00000000;
251
252     COMPARE_M_SIMD (a, e, d, c);
253   }
254 }
255
256 __kernel void m13300_m08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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, const u32 combs_mode, const u32 gid_max)
257 {
258 }
259
260 __kernel void m13300_m16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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, const u32 combs_mode, const u32 gid_max)
261 {
262 }
263
264 __kernel void m13300_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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, const u32 combs_mode, const u32 gid_max)
265 {
266   /**
267    * modifier
268    */
269
270   const u32 lid = get_local_id (0);
271
272   /**
273    * base
274    */
275
276   const u32 gid = get_global_id (0);
277
278   if (gid >= gid_max) return;
279
280   u32 pw_buf0[4];
281   u32 pw_buf1[4];
282
283   pw_buf0[0] = pws[gid].i[0];
284   pw_buf0[1] = pws[gid].i[1];
285   pw_buf0[2] = pws[gid].i[2];
286   pw_buf0[3] = pws[gid].i[3];
287   pw_buf1[0] = pws[gid].i[4];
288   pw_buf1[1] = pws[gid].i[5];
289   pw_buf1[2] = pws[gid].i[6];
290   pw_buf1[3] = pws[gid].i[7];
291
292   const u32 pw_l_len = pws[gid].pw_len;
293
294   /**
295    * digest
296    */
297
298   const u32 search[4] =
299   {
300     digests_buf[digests_offset].digest_buf[DGST_R0],
301     digests_buf[digests_offset].digest_buf[DGST_R1],
302     digests_buf[digests_offset].digest_buf[DGST_R2],
303     digests_buf[digests_offset].digest_buf[DGST_R3]
304   };
305
306   /**
307    * loop
308    */
309
310   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
311   {
312     const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
313
314     const u32x pw_len = pw_l_len + pw_r_len;
315
316     /**
317      * concat password candidate
318      */
319
320     u32x wordl0[4] = { 0 };
321     u32x wordl1[4] = { 0 };
322     u32x wordl2[4] = { 0 };
323     u32x wordl3[4] = { 0 };
324
325     wordl0[0] = pw_buf0[0];
326     wordl0[1] = pw_buf0[1];
327     wordl0[2] = pw_buf0[2];
328     wordl0[3] = pw_buf0[3];
329     wordl1[0] = pw_buf1[0];
330     wordl1[1] = pw_buf1[1];
331     wordl1[2] = pw_buf1[2];
332     wordl1[3] = pw_buf1[3];
333
334     u32x wordr0[4] = { 0 };
335     u32x wordr1[4] = { 0 };
336     u32x wordr2[4] = { 0 };
337     u32x wordr3[4] = { 0 };
338
339     wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
340     wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
341     wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
342     wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
343     wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
344     wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
345     wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
346     wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
347
348     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
349     {
350       switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
351     }
352     else
353     {
354       switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
355     }
356
357     u32x w0[4];
358     u32x w1[4];
359     u32x w2[4];
360     u32x w3[4];
361
362     w0[0] = wordl0[0] | wordr0[0];
363     w0[1] = wordl0[1] | wordr0[1];
364     w0[2] = wordl0[2] | wordr0[2];
365     w0[3] = wordl0[3] | wordr0[3];
366     w1[0] = wordl1[0] | wordr1[0];
367     w1[1] = wordl1[1] | wordr1[1];
368     w1[2] = wordl1[2] | wordr1[2];
369     w1[3] = wordl1[3] | wordr1[3];
370     w2[0] = wordl2[0] | wordr2[0];
371     w2[1] = wordl2[1] | wordr2[1];
372     w2[2] = wordl2[2] | wordr2[2];
373     w2[3] = wordl2[3] | wordr2[3];
374     w3[0] = wordl3[0] | wordr3[0];
375     w3[1] = wordl3[1] | wordr3[1];
376     w3[2] = wordl3[2] | wordr3[2];
377     w3[3] = wordl3[3] | wordr3[3];
378
379     /**
380      * sha1
381      */
382
383     u32x w0_t = swap32 (w0[0]);
384     u32x w1_t = swap32 (w0[1]);
385     u32x w2_t = swap32 (w0[2]);
386     u32x w3_t = swap32 (w0[3]);
387     u32x w4_t = swap32 (w1[0]);
388     u32x w5_t = swap32 (w1[1]);
389     u32x w6_t = swap32 (w1[2]);
390     u32x w7_t = swap32 (w1[3]);
391     u32x w8_t = swap32 (w2[0]);
392     u32x w9_t = swap32 (w2[1]);
393     u32x wa_t = swap32 (w2[2]);
394     u32x wb_t = swap32 (w2[3]);
395     u32x wc_t = swap32 (w3[0]);
396     u32x wd_t = swap32 (w3[1]);
397     u32x we_t = 0;
398     u32x wf_t = pw_len * 8;
399
400     u32x a = SHA1M_A;
401     u32x b = SHA1M_B;
402     u32x c = SHA1M_C;
403     u32x d = SHA1M_D;
404     u32x e = SHA1M_E;
405
406     #undef K
407     #define K SHA1C00
408
409     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t);
410     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t);
411     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2_t);
412     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t);
413     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4_t);
414     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5_t);
415     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6_t);
416     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7_t);
417     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8_t);
418     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9_t);
419     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa_t);
420     SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb_t);
421     SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc_t);
422     SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd_t);
423     SHA1_STEP (SHA1_F0o, b, c, d, e, a, we_t);
424     SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf_t);
425     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t);
426     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t);
427     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t);
428     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t);
429
430     #undef K
431     #define K SHA1C01
432
433     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4_t);
434     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5_t);
435     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6_t);
436     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7_t);
437     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8_t);
438     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9_t);
439     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa_t);
440     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb_t);
441     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc_t);
442     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd_t);
443     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we_t);
444     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf_t);
445     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t);
446     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t);
447     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t);
448     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t);
449     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4_t);
450     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5_t);
451     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6_t);
452     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7_t);
453
454     #undef K
455     #define K SHA1C02
456
457     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8_t);
458     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9_t);
459     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa_t);
460     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb_t);
461     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc_t);
462     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd_t);
463     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we_t);
464     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf_t);
465     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t);
466     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t);
467     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t);
468     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t);
469     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4_t);
470     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5_t);
471     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6_t);
472     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7_t);
473     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8_t);
474     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9_t);
475     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa_t);
476     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb_t);
477
478     #undef K
479     #define K SHA1C03
480
481     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc_t);
482     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd_t);
483     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we_t);
484     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf_t);
485     w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t);
486     w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t);
487     w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t);
488     w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t);
489     w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4_t);
490     w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5_t);
491     w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6_t);
492     w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7_t);
493     w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8_t);
494     w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9_t);
495     wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa_t);
496     wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb_t);
497     wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc_t);
498     wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd_t);
499     we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we_t);
500     wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf_t);
501
502     a += SHA1M_A;
503     e += SHA1M_E;
504     d += SHA1M_D;
505     c += SHA1M_C;
506
507     e &= 0x00000000;
508
509     COMPARE_M_SIMD (a, e, d, c);
510   }
511 }
512
513 __kernel void m13300_s08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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, const u32 combs_mode, const u32 gid_max)
514 {
515 }
516
517 __kernel void m13300_s16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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, const u32 combs_mode, const u32 gid_max)
518 {
519 }