2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
16 #include "include/kernel_functions.c"
17 #include "types_ocl.c"
20 #define COMPARE_S "check_single_comp4.c"
21 #define COMPARE_M "check_multi_comp4.c"
23 static void sha1_transform (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[5])
51 SHA1_STEP (SHA1_F0o, A, B, C, D, E, w0_t);
52 SHA1_STEP (SHA1_F0o, E, A, B, C, D, w1_t);
53 SHA1_STEP (SHA1_F0o, D, E, A, B, C, w2_t);
54 SHA1_STEP (SHA1_F0o, C, D, E, A, B, w3_t);
55 SHA1_STEP (SHA1_F0o, B, C, D, E, A, w4_t);
56 SHA1_STEP (SHA1_F0o, A, B, C, D, E, w5_t);
57 SHA1_STEP (SHA1_F0o, E, A, B, C, D, w6_t);
58 SHA1_STEP (SHA1_F0o, D, E, A, B, C, w7_t);
59 SHA1_STEP (SHA1_F0o, C, D, E, A, B, w8_t);
60 SHA1_STEP (SHA1_F0o, B, C, D, E, A, w9_t);
61 SHA1_STEP (SHA1_F0o, A, B, C, D, E, wa_t);
62 SHA1_STEP (SHA1_F0o, E, A, B, C, D, wb_t);
63 SHA1_STEP (SHA1_F0o, D, E, A, B, C, wc_t);
64 SHA1_STEP (SHA1_F0o, C, D, E, A, B, wd_t);
65 SHA1_STEP (SHA1_F0o, B, C, D, E, A, we_t);
66 SHA1_STEP (SHA1_F0o, A, B, C, D, E, wf_t);
67 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, E, A, B, C, D, w0_t);
68 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, D, E, A, B, C, w1_t);
69 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, C, D, E, A, B, w2_t);
70 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, B, C, D, E, A, w3_t);
75 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w4_t);
76 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w5_t);
77 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w6_t);
78 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w7_t);
79 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w8_t);
80 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w9_t);
81 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wa_t);
82 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, wb_t);
83 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, wc_t);
84 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wd_t);
85 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, we_t);
86 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wf_t);
87 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w0_t);
88 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w1_t);
89 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w2_t);
90 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w3_t);
91 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w4_t);
92 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w5_t);
93 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w6_t);
94 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w7_t);
99 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w8_t);
100 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w9_t);
101 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, wa_t);
102 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, wb_t);
103 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, wc_t);
104 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, wd_t);
105 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, we_t);
106 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, wf_t);
107 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, w0_t);
108 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, w1_t);
109 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w2_t);
110 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w3_t);
111 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, w4_t);
112 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, w5_t);
113 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, w6_t);
114 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w7_t);
115 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w8_t);
116 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, w9_t);
117 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, wa_t);
118 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, wb_t);
123 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, wc_t);
124 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wd_t);
125 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, we_t);
126 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, wf_t);
127 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w0_t);
128 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w1_t);
129 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w2_t);
130 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w3_t);
131 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w4_t);
132 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w5_t);
133 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w6_t);
134 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w7_t);
135 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w8_t);
136 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w9_t);
137 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wa_t);
138 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, wb_t);
139 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wc_t);
140 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, wd_t);
141 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, we_t);
142 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wf_t);
151 static void hmac_sha1_pad (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[5], u32 opad[5])
153 w0[0] = w0[0] ^ 0x36363636;
154 w0[1] = w0[1] ^ 0x36363636;
155 w0[2] = w0[2] ^ 0x36363636;
156 w0[3] = w0[3] ^ 0x36363636;
157 w1[0] = w1[0] ^ 0x36363636;
158 w1[1] = w1[1] ^ 0x36363636;
159 w1[2] = w1[2] ^ 0x36363636;
160 w1[3] = w1[3] ^ 0x36363636;
161 w2[0] = w2[0] ^ 0x36363636;
162 w2[1] = w2[1] ^ 0x36363636;
163 w2[2] = w2[2] ^ 0x36363636;
164 w2[3] = w2[3] ^ 0x36363636;
165 w3[0] = w3[0] ^ 0x36363636;
166 w3[1] = w3[1] ^ 0x36363636;
167 w3[2] = w3[2] ^ 0x36363636;
168 w3[3] = w3[3] ^ 0x36363636;
176 sha1_transform (w0, w1, w2, w3, ipad);
178 w0[0] = w0[0] ^ 0x6a6a6a6a;
179 w0[1] = w0[1] ^ 0x6a6a6a6a;
180 w0[2] = w0[2] ^ 0x6a6a6a6a;
181 w0[3] = w0[3] ^ 0x6a6a6a6a;
182 w1[0] = w1[0] ^ 0x6a6a6a6a;
183 w1[1] = w1[1] ^ 0x6a6a6a6a;
184 w1[2] = w1[2] ^ 0x6a6a6a6a;
185 w1[3] = w1[3] ^ 0x6a6a6a6a;
186 w2[0] = w2[0] ^ 0x6a6a6a6a;
187 w2[1] = w2[1] ^ 0x6a6a6a6a;
188 w2[2] = w2[2] ^ 0x6a6a6a6a;
189 w2[3] = w2[3] ^ 0x6a6a6a6a;
190 w3[0] = w3[0] ^ 0x6a6a6a6a;
191 w3[1] = w3[1] ^ 0x6a6a6a6a;
192 w3[2] = w3[2] ^ 0x6a6a6a6a;
193 w3[3] = w3[3] ^ 0x6a6a6a6a;
201 sha1_transform (w0, w1, w2, w3, opad);
204 static void hmac_sha1_run (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], u32 ipad[5], u32 opad[5], u32 digest[5])
212 sha1_transform (w0, w1, w2, w3, digest);
229 w3[3] = (64 + 20) * 8;
237 sha1_transform (w0, w1, w2, w3, digest);
240 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00150_m04 (__global pw_t *pws, __global gpu_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_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
246 const u32 lid = get_local_id (0);
252 const u32 gid = get_global_id (0);
254 if (gid >= gid_max) return;
258 wordl0[0] = pws[gid].i[ 0];
259 wordl0[1] = pws[gid].i[ 1];
260 wordl0[2] = pws[gid].i[ 2];
261 wordl0[3] = pws[gid].i[ 3];
265 wordl1[0] = pws[gid].i[ 4];
266 wordl1[1] = pws[gid].i[ 5];
267 wordl1[2] = pws[gid].i[ 6];
268 wordl1[3] = pws[gid].i[ 7];
284 const u32 pw_l_len = pws[gid].pw_len;
286 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
288 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
297 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
298 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
299 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
300 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
304 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
305 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
306 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
307 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
309 const u32 salt_len = salt_bufs[salt_pos].salt_len;
315 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
317 const u32 pw_r_len = combs_buf[il_pos].pw_len;
319 const u32 pw_len = pw_l_len + pw_r_len;
323 wordr0[0] = combs_buf[il_pos].i[0];
324 wordr0[1] = combs_buf[il_pos].i[1];
325 wordr0[2] = combs_buf[il_pos].i[2];
326 wordr0[3] = combs_buf[il_pos].i[3];
330 wordr1[0] = combs_buf[il_pos].i[4];
331 wordr1[1] = combs_buf[il_pos].i[5];
332 wordr1[2] = combs_buf[il_pos].i[6];
333 wordr1[3] = combs_buf[il_pos].i[7];
349 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
351 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
356 w0[0] = wordl0[0] | wordr0[0];
357 w0[1] = wordl0[1] | wordr0[1];
358 w0[2] = wordl0[2] | wordr0[2];
359 w0[3] = wordl0[3] | wordr0[3];
363 w1[0] = wordl1[0] | wordr1[0];
364 w1[1] = wordl1[1] | wordr1[1];
365 w1[2] = wordl1[2] | wordr1[2];
366 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];
377 w3[0] = wordl3[0] | wordr3[0];
378 w3[1] = wordl3[1] | wordr3[1];
379 w3[2] = wordl3[2] | wordr3[2];
380 w3[3] = wordl3[3] | wordr3[3];
388 w0_t[0] = swap_workaround (w0[0]);
389 w0_t[1] = swap_workaround (w0[1]);
390 w0_t[2] = swap_workaround (w0[2]);
391 w0_t[3] = swap_workaround (w0[3]);
395 w1_t[0] = swap_workaround (w1[0]);
396 w1_t[1] = swap_workaround (w1[1]);
397 w1_t[2] = swap_workaround (w1[2]);
398 w1_t[3] = swap_workaround (w1[3]);
417 hmac_sha1_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
419 w0_t[0] = swap_workaround (salt_buf0[0]);
420 w0_t[1] = swap_workaround (salt_buf0[1]);
421 w0_t[2] = swap_workaround (salt_buf0[2]);
422 w0_t[3] = swap_workaround (salt_buf0[3]);
423 w1_t[0] = swap_workaround (salt_buf1[0]);
424 w1_t[1] = swap_workaround (salt_buf1[1]);
425 w1_t[2] = swap_workaround (salt_buf1[2]);
426 w1_t[3] = swap_workaround (salt_buf1[3]);
434 w3_t[3] = (64 + salt_len) * 8;
438 hmac_sha1_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
440 const u32 r0 = digest[3];
441 const u32 r1 = digest[4];
442 const u32 r2 = digest[2];
443 const u32 r3 = digest[1];
449 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00150_m08 (__global pw_t *pws, __global gpu_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_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
453 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00150_m16 (__global pw_t *pws, __global gpu_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_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
457 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00150_s04 (__global pw_t *pws, __global gpu_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_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
463 const u32 lid = get_local_id (0);
469 const u32 gid = get_global_id (0);
471 if (gid >= gid_max) return;
475 wordl0[0] = pws[gid].i[ 0];
476 wordl0[1] = pws[gid].i[ 1];
477 wordl0[2] = pws[gid].i[ 2];
478 wordl0[3] = pws[gid].i[ 3];
482 wordl1[0] = pws[gid].i[ 4];
483 wordl1[1] = pws[gid].i[ 5];
484 wordl1[2] = pws[gid].i[ 6];
485 wordl1[3] = pws[gid].i[ 7];
501 const u32 pw_l_len = pws[gid].pw_len;
503 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
505 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
514 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
515 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
516 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
517 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
521 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
522 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
523 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
524 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
526 const u32 salt_len = salt_bufs[salt_pos].salt_len;
532 const u32 search[4] =
534 digests_buf[digests_offset].digest_buf[DGST_R0],
535 digests_buf[digests_offset].digest_buf[DGST_R1],
536 digests_buf[digests_offset].digest_buf[DGST_R2],
537 digests_buf[digests_offset].digest_buf[DGST_R3]
544 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
546 const u32 pw_r_len = combs_buf[il_pos].pw_len;
548 const u32 pw_len = pw_l_len + pw_r_len;
552 wordr0[0] = combs_buf[il_pos].i[0];
553 wordr0[1] = combs_buf[il_pos].i[1];
554 wordr0[2] = combs_buf[il_pos].i[2];
555 wordr0[3] = combs_buf[il_pos].i[3];
559 wordr1[0] = combs_buf[il_pos].i[4];
560 wordr1[1] = combs_buf[il_pos].i[5];
561 wordr1[2] = combs_buf[il_pos].i[6];
562 wordr1[3] = combs_buf[il_pos].i[7];
578 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
580 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
585 w0[0] = wordl0[0] | wordr0[0];
586 w0[1] = wordl0[1] | wordr0[1];
587 w0[2] = wordl0[2] | wordr0[2];
588 w0[3] = wordl0[3] | wordr0[3];
592 w1[0] = wordl1[0] | wordr1[0];
593 w1[1] = wordl1[1] | wordr1[1];
594 w1[2] = wordl1[2] | wordr1[2];
595 w1[3] = wordl1[3] | wordr1[3];
599 w2[0] = wordl2[0] | wordr2[0];
600 w2[1] = wordl2[1] | wordr2[1];
601 w2[2] = wordl2[2] | wordr2[2];
602 w2[3] = wordl2[3] | wordr2[3];
606 w3[0] = wordl3[0] | wordr3[0];
607 w3[1] = wordl3[1] | wordr3[1];
608 w3[2] = wordl3[2] | wordr3[2];
609 w3[3] = wordl3[3] | wordr3[3];
617 w0_t[0] = swap_workaround (w0[0]);
618 w0_t[1] = swap_workaround (w0[1]);
619 w0_t[2] = swap_workaround (w0[2]);
620 w0_t[3] = swap_workaround (w0[3]);
624 w1_t[0] = swap_workaround (w1[0]);
625 w1_t[1] = swap_workaround (w1[1]);
626 w1_t[2] = swap_workaround (w1[2]);
627 w1_t[3] = swap_workaround (w1[3]);
646 hmac_sha1_pad (w0_t, w1_t, w2_t, w3_t, ipad, opad);
648 w0_t[0] = swap_workaround (salt_buf0[0]);
649 w0_t[1] = swap_workaround (salt_buf0[1]);
650 w0_t[2] = swap_workaround (salt_buf0[2]);
651 w0_t[3] = swap_workaround (salt_buf0[3]);
652 w1_t[0] = swap_workaround (salt_buf1[0]);
653 w1_t[1] = swap_workaround (salt_buf1[1]);
654 w1_t[2] = swap_workaround (salt_buf1[2]);
655 w1_t[3] = swap_workaround (salt_buf1[3]);
663 w3_t[3] = (64 + salt_len) * 8;
667 hmac_sha1_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest);
669 const u32 r0 = digest[3];
670 const u32 r1 = digest[4];
671 const u32 r2 = digest[2];
672 const u32 r3 = digest[1];
678 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00150_s08 (__global pw_t *pws, __global gpu_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_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
682 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00150_s16 (__global pw_t *pws, __global gpu_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_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)