2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * magnum <john.magnum@hushmail.com>
12 #include "include/constants.h"
13 #include "include/kernel_vendor.h"
20 #include "include/kernel_functions.c"
21 #include "OpenCL/types_ocl.c"
22 #include "OpenCL/common.c"
23 #include "include/rp_kernel.h"
24 #include "OpenCL/rp.c"
25 #include "OpenCL/simd.c"
28 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i)])
30 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
32 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
34 #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])
36 #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])
39 __kernel void m03710_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)
45 const u32 gid = get_global_id (0);
46 const u32 lid = get_local_id (0);
47 const u32 lsz = get_local_size (0);
53 __local u32 l_bin2asc[256];
55 for (u32 i = lid; i < 256; i += lsz)
57 const u32 i0 = (i >> 0) & 15;
58 const u32 i1 = (i >> 4) & 15;
60 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
61 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
64 barrier (CLK_LOCAL_MEM_FENCE);
66 if (gid >= gid_max) return;
74 pw_buf0[0] = pws[gid].i[ 0];
75 pw_buf0[1] = pws[gid].i[ 1];
76 pw_buf0[2] = pws[gid].i[ 2];
77 pw_buf0[3] = pws[gid].i[ 3];
81 pw_buf1[0] = pws[gid].i[ 4];
82 pw_buf1[1] = pws[gid].i[ 5];
83 pw_buf1[2] = pws[gid].i[ 6];
84 pw_buf1[3] = pws[gid].i[ 7];
86 const u32 pw_len = pws[gid].pw_len;
94 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
95 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
96 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
97 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
101 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
102 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
103 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
104 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
120 const u32 salt_len = salt_bufs[salt_pos].salt_len;
122 const u32x pw_salt_len = 32 + salt_len;
128 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
135 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
137 append_0x80_2x4_VV (w0, w1, out_len);
146 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
147 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
148 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
149 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
150 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
151 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
152 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
153 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
154 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
155 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
156 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
157 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
158 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
159 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
160 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
161 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
163 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
164 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
165 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
166 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
167 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
168 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
169 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
170 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
171 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
172 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
173 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
174 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
175 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
176 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
177 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
178 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
180 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
181 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
182 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
183 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
184 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
185 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
186 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
187 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
188 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
189 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
190 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
191 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
192 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
193 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
194 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
195 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
197 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
198 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
199 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
200 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
201 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
202 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
203 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
204 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
205 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
206 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
207 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
208 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
209 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
210 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
211 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
212 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
224 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
225 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
226 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
227 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
228 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
229 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
230 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
231 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
232 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
233 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
234 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
235 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
236 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
237 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
238 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
239 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
241 w2_t[0] = 0x00000080;
255 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
257 w3_t[2] = pw_salt_len * 8;
259 w0_t[0] |= salt_buf0[0];
260 w0_t[1] |= salt_buf0[1];
261 w0_t[2] |= salt_buf0[2];
262 w0_t[3] |= salt_buf0[3];
263 w1_t[0] |= salt_buf1[0];
264 w1_t[1] |= salt_buf1[1];
265 w1_t[2] |= salt_buf1[2];
266 w1_t[3] |= salt_buf1[3];
267 w2_t[0] |= salt_buf2[0];
268 w2_t[1] |= salt_buf2[1];
269 w2_t[2] |= salt_buf2[2];
270 w2_t[3] |= salt_buf2[3];
271 w3_t[0] |= salt_buf3[0];
272 w3_t[1] |= salt_buf3[1];
273 w3_t[2] |= salt_buf3[2];
274 w3_t[3] |= salt_buf3[3];
285 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
286 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
287 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
288 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
289 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
290 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
291 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
292 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
293 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
294 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
295 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
296 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
297 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
298 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
299 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
300 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
302 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
303 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
304 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
305 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
306 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
307 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
308 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
309 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
310 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
311 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
312 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
313 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
314 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
315 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
316 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
317 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
319 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
320 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
321 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
322 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
323 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
324 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
325 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
326 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
327 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
328 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
329 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
330 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
331 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
332 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
333 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
334 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
336 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
337 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
338 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
339 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
340 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
341 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
342 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
343 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
344 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
345 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
346 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
347 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
348 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
349 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
350 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
351 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
353 COMPARE_M_SIMD (a, d, c, b);
357 __kernel void m03710_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)
361 __kernel void m03710_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)
365 __kernel void m03710_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)
371 const u32 gid = get_global_id (0);
372 const u32 lid = get_local_id (0);
373 const u32 lsz = get_local_size (0);
379 __local u32 l_bin2asc[256];
381 for (u32 i = lid; i < 256; i += lsz)
383 const u32 i0 = (i >> 0) & 15;
384 const u32 i1 = (i >> 4) & 15;
386 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
387 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
390 barrier (CLK_LOCAL_MEM_FENCE);
392 if (gid >= gid_max) return;
400 pw_buf0[0] = pws[gid].i[ 0];
401 pw_buf0[1] = pws[gid].i[ 1];
402 pw_buf0[2] = pws[gid].i[ 2];
403 pw_buf0[3] = pws[gid].i[ 3];
407 pw_buf1[0] = pws[gid].i[ 4];
408 pw_buf1[1] = pws[gid].i[ 5];
409 pw_buf1[2] = pws[gid].i[ 6];
410 pw_buf1[3] = pws[gid].i[ 7];
412 const u32 pw_len = pws[gid].pw_len;
420 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
421 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
422 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
423 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
427 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
428 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
429 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
430 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
446 const u32 salt_len = salt_bufs[salt_pos].salt_len;
448 const u32x pw_salt_len = 32 + salt_len;
454 const u32 search[4] =
456 digests_buf[digests_offset].digest_buf[DGST_R0],
457 digests_buf[digests_offset].digest_buf[DGST_R1],
458 digests_buf[digests_offset].digest_buf[DGST_R2],
459 digests_buf[digests_offset].digest_buf[DGST_R3]
466 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
473 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
475 append_0x80_2x4_VV (w0, w1, out_len);
484 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
485 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
486 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
487 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
488 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
489 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
490 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
491 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
492 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
493 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
494 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
495 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
496 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
497 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
498 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
499 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
501 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
502 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
503 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
504 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
505 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
506 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
507 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
508 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
509 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
510 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
511 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
512 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
513 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
514 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
515 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
516 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
518 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
519 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
520 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
521 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
522 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
523 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
524 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
525 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
526 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
527 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
528 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
529 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
530 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
531 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
532 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
533 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
535 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
536 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
537 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
538 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
539 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
540 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
541 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
542 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
543 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
544 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
545 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
546 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
547 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
548 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
549 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
550 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
562 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
563 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
564 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
565 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
566 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
567 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
568 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
569 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
570 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
571 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
572 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
573 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
574 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
575 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
576 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
577 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
579 w2_t[0] = 0x00000080;
593 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
595 w3_t[2] = pw_salt_len * 8;
597 w0_t[0] |= salt_buf0[0];
598 w0_t[1] |= salt_buf0[1];
599 w0_t[2] |= salt_buf0[2];
600 w0_t[3] |= salt_buf0[3];
601 w1_t[0] |= salt_buf1[0];
602 w1_t[1] |= salt_buf1[1];
603 w1_t[2] |= salt_buf1[2];
604 w1_t[3] |= salt_buf1[3];
605 w2_t[0] |= salt_buf2[0];
606 w2_t[1] |= salt_buf2[1];
607 w2_t[2] |= salt_buf2[2];
608 w2_t[3] |= salt_buf2[3];
609 w3_t[0] |= salt_buf3[0];
610 w3_t[1] |= salt_buf3[1];
611 w3_t[2] |= salt_buf3[2];
612 w3_t[3] |= salt_buf3[3];
623 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
624 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
625 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
626 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
627 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
628 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
629 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
630 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
631 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
632 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
633 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
634 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
635 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
636 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
637 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
638 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
640 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
641 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
642 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
643 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
644 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
645 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
646 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
647 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
648 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
649 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
650 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
651 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
652 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
653 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
654 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
655 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
657 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
658 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
659 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
660 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
661 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
662 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
663 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
664 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
665 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
666 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
667 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
668 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
669 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
670 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
671 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
672 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
674 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
675 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
676 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
677 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
678 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
679 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
680 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
681 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
682 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
683 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
684 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
685 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
686 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
687 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
688 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
689 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
691 COMPARE_S_SIMD (a, d, c, b);
695 __kernel void m03710_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)
699 __kernel void m03710_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)