2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "inc_hash_constants.h"
11 #include "inc_vendor.cl"
18 #include "inc_hash_functions.cl"
19 #include "inc_types.cl"
20 #include "inc_common.cl"
21 #include "inc_simd.cl"
24 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i)])
26 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
28 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
30 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3], l_bin2asc[(i).s4], l_bin2asc[(i).s5], l_bin2asc[(i).s6], l_bin2asc[(i).s7])
32 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3], l_bin2asc[(i).s4], l_bin2asc[(i).s5], l_bin2asc[(i).s6], l_bin2asc[(i).s7], l_bin2asc[(i).s8], l_bin2asc[(i).s9], l_bin2asc[(i).sa], l_bin2asc[(i).sb], l_bin2asc[(i).sc], l_bin2asc[(i).sd], l_bin2asc[(i).se], l_bin2asc[(i).sf])
35 __kernel void m02610_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_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, const u32 combs_mode, const u32 gid_max)
41 const u32 gid = get_global_id (0);
42 const u32 lid = get_local_id (0);
43 const u32 lsz = get_local_size (0);
49 __local u32 l_bin2asc[256];
51 for (u32 i = lid; i < 256; i += lsz)
53 const u32 i0 = (i >> 0) & 15;
54 const u32 i1 = (i >> 4) & 15;
56 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
57 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
60 barrier (CLK_LOCAL_MEM_FENCE);
62 if (gid >= gid_max) return;
71 pw_buf0[0] = pws[gid].i[0];
72 pw_buf0[1] = pws[gid].i[1];
73 pw_buf0[2] = pws[gid].i[2];
74 pw_buf0[3] = pws[gid].i[3];
75 pw_buf1[0] = pws[gid].i[4];
76 pw_buf1[1] = pws[gid].i[5];
77 pw_buf1[2] = pws[gid].i[6];
78 pw_buf1[3] = pws[gid].i[7];
80 const u32 pw_l_len = pws[gid].pw_len;
91 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
92 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
93 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
94 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
95 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
96 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
108 const u32 salt_len = salt_bufs[salt_pos].salt_len;
114 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
116 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
118 const u32x pw_len = pw_l_len + pw_r_len;
121 * concat password candidate
124 u32x wordl0[4] = { 0 };
125 u32x wordl1[4] = { 0 };
126 u32x wordl2[4] = { 0 };
127 u32x wordl3[4] = { 0 };
129 wordl0[0] = pw_buf0[0];
130 wordl0[1] = pw_buf0[1];
131 wordl0[2] = pw_buf0[2];
132 wordl0[3] = pw_buf0[3];
133 wordl1[0] = pw_buf1[0];
134 wordl1[1] = pw_buf1[1];
135 wordl1[2] = pw_buf1[2];
136 wordl1[3] = pw_buf1[3];
138 u32x wordr0[4] = { 0 };
139 u32x wordr1[4] = { 0 };
140 u32x wordr2[4] = { 0 };
141 u32x wordr3[4] = { 0 };
143 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
144 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
145 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
146 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
147 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
148 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
149 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
150 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
152 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
154 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
158 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
166 w0[0] = wordl0[0] | wordr0[0];
167 w0[1] = wordl0[1] | wordr0[1];
168 w0[2] = wordl0[2] | wordr0[2];
169 w0[3] = wordl0[3] | wordr0[3];
170 w1[0] = wordl1[0] | wordr1[0];
171 w1[1] = wordl1[1] | wordr1[1];
172 w1[2] = wordl1[2] | wordr1[2];
173 w1[3] = wordl1[3] | wordr1[3];
174 w2[0] = wordl2[0] | wordr2[0];
175 w2[1] = wordl2[1] | wordr2[1];
176 w2[2] = wordl2[2] | wordr2[2];
177 w2[3] = wordl2[3] | wordr2[3];
178 w3[0] = wordl3[0] | wordr3[0];
179 w3[1] = wordl3[1] | wordr3[1];
192 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
193 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
194 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
195 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
196 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
197 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
198 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
199 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
200 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
201 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
202 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
203 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
204 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
205 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
206 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
207 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
209 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
210 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
211 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
212 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
213 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
214 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
215 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
216 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
217 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
218 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
219 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
220 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
221 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
222 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
223 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
224 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
226 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
227 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
228 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
229 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
230 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
231 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
232 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
233 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
234 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
235 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
236 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
237 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
238 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
239 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
240 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
241 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
243 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
244 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
245 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
246 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
247 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
248 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
249 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
250 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
251 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
252 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
253 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
254 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
255 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
256 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
257 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
258 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
265 w0[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
266 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
267 w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
268 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
269 w0[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
270 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
271 w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
272 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
273 w1[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
274 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
275 w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
276 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
277 w1[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
278 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
279 w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
280 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
282 w2[0] = salt_buf0[0];
283 w2[1] = salt_buf0[1];
284 w2[2] = salt_buf0[2];
285 w2[3] = salt_buf0[3];
286 w3[0] = salt_buf1[0];
287 w3[1] = salt_buf1[1];
288 w3[2] = (32 + salt_len) * 8;
296 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
297 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
298 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
299 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
300 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
301 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
302 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
303 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
304 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
305 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
306 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
307 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
308 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
309 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
310 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
311 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
313 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
314 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
315 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
316 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
317 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
318 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
319 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
320 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
321 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
322 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
323 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
324 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
325 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
326 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
327 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
328 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
330 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
331 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
332 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
333 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
334 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
335 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
336 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
337 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
338 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
339 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
340 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
341 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
342 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
343 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
344 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
345 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
347 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
348 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
349 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
350 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
351 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
352 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
353 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
354 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
355 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
356 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
357 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
358 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
359 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
360 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
361 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
362 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
364 COMPARE_M_SIMD (a, d, c, b);
368 __kernel void m02610_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_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, const u32 combs_mode, const u32 gid_max)
372 __kernel void m02610_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_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, const u32 combs_mode, const u32 gid_max)
376 __kernel void m02610_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_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, const u32 combs_mode, const u32 gid_max)
382 const u32 gid = get_global_id (0);
383 const u32 lid = get_local_id (0);
384 const u32 lsz = get_local_size (0);
390 __local u32 l_bin2asc[256];
392 for (u32 i = lid; i < 256; i += lsz)
394 const u32 i0 = (i >> 0) & 15;
395 const u32 i1 = (i >> 4) & 15;
397 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
398 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
401 barrier (CLK_LOCAL_MEM_FENCE);
403 if (gid >= gid_max) return;
412 pw_buf0[0] = pws[gid].i[0];
413 pw_buf0[1] = pws[gid].i[1];
414 pw_buf0[2] = pws[gid].i[2];
415 pw_buf0[3] = pws[gid].i[3];
416 pw_buf1[0] = pws[gid].i[4];
417 pw_buf1[1] = pws[gid].i[5];
418 pw_buf1[2] = pws[gid].i[6];
419 pw_buf1[3] = pws[gid].i[7];
421 const u32 pw_l_len = pws[gid].pw_len;
432 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
433 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
434 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
435 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
436 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
437 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
449 const u32 salt_len = salt_bufs[salt_pos].salt_len;
455 const u32 search[4] =
457 digests_buf[digests_offset].digest_buf[DGST_R0],
458 digests_buf[digests_offset].digest_buf[DGST_R1],
459 digests_buf[digests_offset].digest_buf[DGST_R2],
460 digests_buf[digests_offset].digest_buf[DGST_R3]
467 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
469 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
471 const u32x pw_len = pw_l_len + pw_r_len;
474 * concat password candidate
477 u32x wordl0[4] = { 0 };
478 u32x wordl1[4] = { 0 };
479 u32x wordl2[4] = { 0 };
480 u32x wordl3[4] = { 0 };
482 wordl0[0] = pw_buf0[0];
483 wordl0[1] = pw_buf0[1];
484 wordl0[2] = pw_buf0[2];
485 wordl0[3] = pw_buf0[3];
486 wordl1[0] = pw_buf1[0];
487 wordl1[1] = pw_buf1[1];
488 wordl1[2] = pw_buf1[2];
489 wordl1[3] = pw_buf1[3];
491 u32x wordr0[4] = { 0 };
492 u32x wordr1[4] = { 0 };
493 u32x wordr2[4] = { 0 };
494 u32x wordr3[4] = { 0 };
496 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
497 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
498 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
499 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
500 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
501 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
502 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
503 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
505 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
507 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
511 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
519 w0[0] = wordl0[0] | wordr0[0];
520 w0[1] = wordl0[1] | wordr0[1];
521 w0[2] = wordl0[2] | wordr0[2];
522 w0[3] = wordl0[3] | wordr0[3];
523 w1[0] = wordl1[0] | wordr1[0];
524 w1[1] = wordl1[1] | wordr1[1];
525 w1[2] = wordl1[2] | wordr1[2];
526 w1[3] = wordl1[3] | wordr1[3];
527 w2[0] = wordl2[0] | wordr2[0];
528 w2[1] = wordl2[1] | wordr2[1];
529 w2[2] = wordl2[2] | wordr2[2];
530 w2[3] = wordl2[3] | wordr2[3];
531 w3[0] = wordl3[0] | wordr3[0];
532 w3[1] = wordl3[1] | wordr3[1];
545 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
546 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
547 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
548 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
549 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
550 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
551 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
552 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
553 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
554 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
555 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
556 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
557 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
558 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
559 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
560 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
562 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
563 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
564 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
565 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
566 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
567 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
568 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
569 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
570 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
571 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
572 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
573 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
574 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
575 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
576 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
577 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
579 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
580 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
581 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
582 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
583 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
584 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
585 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
586 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
587 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
588 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
589 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
590 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
591 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
592 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
593 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
594 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
596 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
597 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
598 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
599 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
600 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
601 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
602 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
603 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
604 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
605 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
606 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
607 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
608 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
609 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
610 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
611 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
618 w0[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
619 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
620 w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
621 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
622 w0[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
623 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
624 w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
625 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
626 w1[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
627 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
628 w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
629 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
630 w1[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
631 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
632 w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
633 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
635 w2[0] = salt_buf0[0];
636 w2[1] = salt_buf0[1];
637 w2[2] = salt_buf0[2];
638 w2[3] = salt_buf0[3];
639 w3[0] = salt_buf1[0];
640 w3[1] = salt_buf1[1];
641 w3[2] = (32 + salt_len) * 8;
649 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
650 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
651 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
652 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
653 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
654 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
655 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
656 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
657 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
658 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
659 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
660 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
661 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
662 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
663 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
664 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
666 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
667 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
668 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
669 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
670 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
671 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
672 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
673 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
674 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
675 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
676 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
677 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
678 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
679 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
680 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
681 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
683 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
684 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
685 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
686 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
687 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
688 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
689 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
690 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
691 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
692 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
693 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
694 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
695 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
696 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
697 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
698 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
700 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
701 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
702 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
703 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
704 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
705 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
706 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
707 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
708 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
709 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
710 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
711 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
712 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
714 if (MATCHES_NONE_VS (a, search[0])) continue;
716 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
717 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
718 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
720 COMPARE_S_SIMD (a, d, c, b);
724 __kernel void m02610_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_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, const u32 combs_mode, const u32 gid_max)
728 __kernel void m02610_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_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, const u32 combs_mode, const u32 gid_max)