2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * magnum <john.magnum@hushmail.com>
12 #include "inc_vendor.cl"
13 #include "inc_hash_constants.h"
14 #include "inc_hash_functions.cl"
15 #include "inc_types.cl"
16 #include "inc_common.cl"
19 #include "inc_simd.cl"
22 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i)])
24 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
26 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
28 #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])
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], 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])
33 __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)
39 const u32 gid = get_global_id (0);
40 const u32 lid = get_local_id (0);
41 const u32 lsz = get_local_size (0);
47 __local u32 l_bin2asc[256];
49 for (u32 i = lid; i < 256; i += lsz)
51 const u32 i0 = (i >> 0) & 15;
52 const u32 i1 = (i >> 4) & 15;
54 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
55 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
58 barrier (CLK_LOCAL_MEM_FENCE);
60 if (gid >= gid_max) return;
69 pw_buf0[0] = pws[gid].i[0];
70 pw_buf0[1] = pws[gid].i[1];
71 pw_buf0[2] = pws[gid].i[2];
72 pw_buf0[3] = pws[gid].i[3];
73 pw_buf1[0] = pws[gid].i[4];
74 pw_buf1[1] = pws[gid].i[5];
75 pw_buf1[2] = pws[gid].i[6];
76 pw_buf1[3] = pws[gid].i[7];
78 const u32 pw_len = pws[gid].pw_len;
89 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
90 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
91 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
92 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
93 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
94 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
95 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
96 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
97 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
98 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
99 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
100 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
101 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
102 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
103 salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
104 salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
106 const u32 salt_len = salt_bufs[salt_pos].salt_len;
108 const u32 pw_salt_len = 32 + salt_len;
114 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
121 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
123 append_0x80_2x4_VV (w0, w1, out_len);
133 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
134 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
135 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
136 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
137 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
138 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
139 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
140 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
141 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
142 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
143 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
144 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
145 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
146 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
147 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
148 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
150 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
151 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
152 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
153 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
154 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
155 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
156 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
157 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
158 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
159 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
160 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
161 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
162 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
163 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
164 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
165 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
167 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
168 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
169 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
170 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
171 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
172 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
173 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
174 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
175 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
176 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
177 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
178 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
179 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
180 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
181 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
182 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
184 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
185 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
186 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
187 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
188 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
189 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
190 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
191 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
192 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
193 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
194 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
195 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
196 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
197 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
198 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
199 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
206 w0[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
207 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
208 w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
209 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
210 w0[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
211 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
212 w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
213 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
214 w1[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
215 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
216 w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
217 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
218 w1[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
219 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
220 w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
221 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
235 switch_buffer_by_offset_le (w0, w1, w2, w3, salt_len);
237 w3[2] = pw_salt_len * 8;
240 w0[0] |= salt_buf0[0];
241 w0[1] |= salt_buf0[1];
242 w0[2] |= salt_buf0[2];
243 w0[3] |= salt_buf0[3];
244 w1[0] |= salt_buf1[0];
245 w1[1] |= salt_buf1[1];
246 w1[2] |= salt_buf1[2];
247 w1[3] |= salt_buf1[3];
248 w2[0] |= salt_buf2[0];
249 w2[1] |= salt_buf2[1];
250 w2[2] |= salt_buf2[2];
251 w2[3] |= salt_buf2[3];
252 w3[0] |= salt_buf3[0];
253 w3[1] |= salt_buf3[1];
254 w3[2] |= salt_buf3[2];
255 w3[3] |= salt_buf3[3];
266 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
267 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
268 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
269 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
270 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
271 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
272 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
273 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
274 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
275 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
276 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
277 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
278 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
279 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
280 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
281 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
283 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
284 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
285 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
286 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
287 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
288 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
289 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
290 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
291 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
292 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
293 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
294 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
295 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
296 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
297 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
298 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
300 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
301 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
302 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
303 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
304 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
305 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
306 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
307 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
308 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
309 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
310 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
311 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
312 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
313 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
314 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
315 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
317 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
318 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
319 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
320 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
321 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
322 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
323 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
324 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
325 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
326 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
327 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
328 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
329 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
330 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
331 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
332 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
334 COMPARE_M_SIMD (a, d, c, b);
338 __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)
342 __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)
346 __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)
352 const u32 gid = get_global_id (0);
353 const u32 lid = get_local_id (0);
354 const u32 lsz = get_local_size (0);
360 __local u32 l_bin2asc[256];
362 for (u32 i = lid; i < 256; i += lsz)
364 const u32 i0 = (i >> 0) & 15;
365 const u32 i1 = (i >> 4) & 15;
367 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
368 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
371 barrier (CLK_LOCAL_MEM_FENCE);
373 if (gid >= gid_max) return;
382 pw_buf0[0] = pws[gid].i[0];
383 pw_buf0[1] = pws[gid].i[1];
384 pw_buf0[2] = pws[gid].i[2];
385 pw_buf0[3] = pws[gid].i[3];
386 pw_buf1[0] = pws[gid].i[4];
387 pw_buf1[1] = pws[gid].i[5];
388 pw_buf1[2] = pws[gid].i[6];
389 pw_buf1[3] = pws[gid].i[7];
391 const u32 pw_len = pws[gid].pw_len;
402 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
403 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
404 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
405 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
406 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
407 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
408 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
409 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
410 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
411 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
412 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
413 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
414 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
415 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
416 salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
417 salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
419 const u32 salt_len = salt_bufs[salt_pos].salt_len;
421 const u32 pw_salt_len = 32 + salt_len;
427 const u32 search[4] =
429 digests_buf[digests_offset].digest_buf[DGST_R0],
430 digests_buf[digests_offset].digest_buf[DGST_R1],
431 digests_buf[digests_offset].digest_buf[DGST_R2],
432 digests_buf[digests_offset].digest_buf[DGST_R3]
439 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
446 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
448 append_0x80_2x4_VV (w0, w1, out_len);
458 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
459 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
460 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
461 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
462 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
463 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
464 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
465 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
466 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
467 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
468 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
469 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
470 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
471 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
472 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
473 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
475 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
476 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
477 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
478 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
479 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
480 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
481 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
482 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
483 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
484 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
485 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
486 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
487 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
488 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
489 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
490 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
492 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
493 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
494 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
495 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
496 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
497 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
498 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
499 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
500 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
501 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
502 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
503 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
504 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
505 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
506 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
507 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
509 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
510 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
511 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
512 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
513 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
514 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
515 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
516 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
517 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
518 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
519 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
520 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
521 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
522 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
523 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
524 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
531 w0[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
532 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
533 w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
534 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
535 w0[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
536 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
537 w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
538 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
539 w1[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
540 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
541 w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
542 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
543 w1[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
544 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
545 w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
546 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
560 switch_buffer_by_offset_le (w0, w1, w2, w3, salt_len);
562 w3[2] = pw_salt_len * 8;
565 w0[0] |= salt_buf0[0];
566 w0[1] |= salt_buf0[1];
567 w0[2] |= salt_buf0[2];
568 w0[3] |= salt_buf0[3];
569 w1[0] |= salt_buf1[0];
570 w1[1] |= salt_buf1[1];
571 w1[2] |= salt_buf1[2];
572 w1[3] |= salt_buf1[3];
573 w2[0] |= salt_buf2[0];
574 w2[1] |= salt_buf2[1];
575 w2[2] |= salt_buf2[2];
576 w2[3] |= salt_buf2[3];
577 w3[0] |= salt_buf3[0];
578 w3[1] |= salt_buf3[1];
579 w3[2] |= salt_buf3[2];
580 w3[3] |= salt_buf3[3];
591 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
592 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
593 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
594 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
595 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
596 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
597 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
598 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
599 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
600 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
601 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
602 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
603 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
604 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
605 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
606 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
608 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
609 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
610 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
611 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
612 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
613 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
614 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
615 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
616 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
617 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
618 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
619 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
620 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
621 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
622 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
623 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
625 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
626 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
627 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
628 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
629 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
630 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
631 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
632 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
633 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
634 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
635 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
636 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
637 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
638 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
639 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
640 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
642 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
643 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
644 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
645 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
646 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
647 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
648 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
649 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
650 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
651 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
652 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
653 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
654 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
656 if (MATCHES_NONE_VS (a, search[0])) continue;
658 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
659 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
660 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
662 COMPARE_S_SIMD (a, d, c, b);
666 __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)
670 __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)