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;
75 pw_buf0[0] = pws[gid].i[0];
76 pw_buf0[1] = pws[gid].i[1];
77 pw_buf0[2] = pws[gid].i[2];
78 pw_buf0[3] = pws[gid].i[3];
79 pw_buf1[0] = pws[gid].i[4];
80 pw_buf1[1] = pws[gid].i[5];
81 pw_buf1[2] = pws[gid].i[6];
82 pw_buf1[3] = pws[gid].i[7];
84 const u32 pw_len = pws[gid].pw_len;
95 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
96 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
97 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
98 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
99 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
100 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
101 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
102 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
103 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
104 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
105 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
106 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
107 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
108 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
109 salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
110 salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
112 const u32 salt_len = salt_bufs[salt_pos].salt_len;
114 const u32 pw_salt_len = 32 + salt_len;
120 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
127 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
129 append_0x80_2x4_VV (w0, w1, out_len);
139 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
140 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
141 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
142 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
143 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
144 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
145 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
146 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
147 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
148 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
149 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
150 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
151 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
152 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
153 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
154 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
156 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
157 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
158 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
159 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
160 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
161 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
162 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
163 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
164 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
165 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
166 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
167 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
168 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
169 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
170 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
171 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
173 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
174 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
175 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
176 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
177 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
178 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
179 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
180 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
181 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
182 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
183 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
184 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
185 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
186 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
187 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
188 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
190 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
191 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
192 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
193 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
194 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
195 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
196 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
197 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
198 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
199 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
200 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
201 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
202 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
203 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
204 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
205 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
212 w0[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
213 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
214 w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
215 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
216 w0[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
217 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
218 w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
219 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
220 w1[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
221 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
222 w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
223 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
224 w1[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
225 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
226 w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
227 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
241 switch_buffer_by_offset_le (w0, w1, w2, w3, salt_len);
243 w3[2] = pw_salt_len * 8;
246 w0[0] |= salt_buf0[0];
247 w0[1] |= salt_buf0[1];
248 w0[2] |= salt_buf0[2];
249 w0[3] |= salt_buf0[3];
250 w1[0] |= salt_buf1[0];
251 w1[1] |= salt_buf1[1];
252 w1[2] |= salt_buf1[2];
253 w1[3] |= salt_buf1[3];
254 w2[0] |= salt_buf2[0];
255 w2[1] |= salt_buf2[1];
256 w2[2] |= salt_buf2[2];
257 w2[3] |= salt_buf2[3];
258 w3[0] |= salt_buf3[0];
259 w3[1] |= salt_buf3[1];
260 w3[2] |= salt_buf3[2];
261 w3[3] |= salt_buf3[3];
272 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
273 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
274 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
275 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
276 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
277 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
278 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
279 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
280 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
281 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
282 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
283 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
284 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
285 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
286 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
287 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
289 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
290 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
291 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
292 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
293 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
294 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
295 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
296 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
297 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
298 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
299 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
300 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
301 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
302 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
303 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
304 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
306 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
307 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
308 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
309 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
310 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
311 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
312 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
313 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
314 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
315 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
316 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
317 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
318 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
319 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
320 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
321 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
323 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
324 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
325 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
326 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
327 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
328 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
329 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
330 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
331 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
332 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
333 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
334 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
335 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
336 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
337 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
338 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
340 COMPARE_M_SIMD (a, d, c, b);
344 __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)
348 __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)
352 __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)
358 const u32 gid = get_global_id (0);
359 const u32 lid = get_local_id (0);
360 const u32 lsz = get_local_size (0);
366 __local u32 l_bin2asc[256];
368 for (u32 i = lid; i < 256; i += lsz)
370 const u32 i0 = (i >> 0) & 15;
371 const u32 i1 = (i >> 4) & 15;
373 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
374 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
377 barrier (CLK_LOCAL_MEM_FENCE);
379 if (gid >= gid_max) return;
388 pw_buf0[0] = pws[gid].i[0];
389 pw_buf0[1] = pws[gid].i[1];
390 pw_buf0[2] = pws[gid].i[2];
391 pw_buf0[3] = pws[gid].i[3];
392 pw_buf1[0] = pws[gid].i[4];
393 pw_buf1[1] = pws[gid].i[5];
394 pw_buf1[2] = pws[gid].i[6];
395 pw_buf1[3] = pws[gid].i[7];
397 const u32 pw_len = pws[gid].pw_len;
408 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
409 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
410 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
411 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
412 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
413 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
414 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
415 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
416 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
417 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
418 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
419 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
420 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
421 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
422 salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
423 salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
425 const u32 salt_len = salt_bufs[salt_pos].salt_len;
427 const u32 pw_salt_len = 32 + salt_len;
433 const u32 search[4] =
435 digests_buf[digests_offset].digest_buf[DGST_R0],
436 digests_buf[digests_offset].digest_buf[DGST_R1],
437 digests_buf[digests_offset].digest_buf[DGST_R2],
438 digests_buf[digests_offset].digest_buf[DGST_R3]
445 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
452 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
454 append_0x80_2x4_VV (w0, w1, out_len);
464 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
465 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
466 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
467 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
468 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
469 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
470 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
471 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
472 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
473 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
474 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
475 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
476 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
477 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
478 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
479 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
481 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
482 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
483 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
484 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
485 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
486 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
487 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
488 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
489 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
490 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
491 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
492 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
493 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
494 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
495 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
496 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
498 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
499 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
500 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
501 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
502 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
503 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
504 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
505 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
506 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
507 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
508 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
509 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
510 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
511 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
512 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
513 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
515 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
516 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
517 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
518 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
519 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
520 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
521 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
522 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
523 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
524 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
525 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
526 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
527 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
528 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
529 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
530 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
537 w0[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
538 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
539 w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
540 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
541 w0[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
542 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
543 w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
544 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
545 w1[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
546 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
547 w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
548 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
549 w1[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
550 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
551 w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
552 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
566 switch_buffer_by_offset_le (w0, w1, w2, w3, salt_len);
568 w3[2] = pw_salt_len * 8;
571 w0[0] |= salt_buf0[0];
572 w0[1] |= salt_buf0[1];
573 w0[2] |= salt_buf0[2];
574 w0[3] |= salt_buf0[3];
575 w1[0] |= salt_buf1[0];
576 w1[1] |= salt_buf1[1];
577 w1[2] |= salt_buf1[2];
578 w1[3] |= salt_buf1[3];
579 w2[0] |= salt_buf2[0];
580 w2[1] |= salt_buf2[1];
581 w2[2] |= salt_buf2[2];
582 w2[3] |= salt_buf2[3];
583 w3[0] |= salt_buf3[0];
584 w3[1] |= salt_buf3[1];
585 w3[2] |= salt_buf3[2];
586 w3[3] |= salt_buf3[3];
597 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
598 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
599 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
600 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
601 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
602 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
603 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
604 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
605 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
606 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
607 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
608 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
609 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
610 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
611 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
612 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
614 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
615 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
616 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
617 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
618 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
619 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
620 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
621 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
622 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
623 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
624 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
625 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
626 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
627 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
628 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
629 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
631 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
632 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
633 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
634 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
635 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
636 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
637 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
638 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
639 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
640 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
641 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
642 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
643 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
644 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
645 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
646 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
648 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
649 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
650 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
651 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
652 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
653 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
654 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
655 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
656 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
657 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
658 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
659 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
660 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
662 if (MATCHES_NONE_VS (a, search[0])) continue;
664 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
665 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
666 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
668 COMPARE_S_SIMD (a, d, c, b);
672 __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)
676 __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)