2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "include/constants.h"
11 #include "include/kernel_vendor.h"
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
21 #include "include/rp_kernel.h"
22 #include "OpenCL/rp.c"
23 #include "OpenCL/simd.c"
25 __kernel void m05100_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)
31 const u32 lid = get_local_id (0);
37 const u32 gid = get_global_id (0);
39 if (gid >= gid_max) return;
44 pw_buf0[0] = pws[gid].i[0];
45 pw_buf0[1] = pws[gid].i[1];
46 pw_buf0[2] = pws[gid].i[2];
47 pw_buf0[3] = pws[gid].i[3];
48 pw_buf1[0] = pws[gid].i[4];
49 pw_buf1[1] = pws[gid].i[5];
50 pw_buf1[2] = pws[gid].i[6];
51 pw_buf1[3] = pws[gid].i[7];
53 const u32 pw_len = pws[gid].pw_len;
61 digests_buf[digests_offset].digest_buf[DGST_R0],
62 digests_buf[digests_offset].digest_buf[DGST_R1],
63 digests_buf[digests_offset].digest_buf[DGST_R2],
64 digests_buf[digests_offset].digest_buf[DGST_R3]
71 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
78 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
80 append_0x80_2x4_VV (w0, w1, out_len);
94 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
95 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
96 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
97 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
98 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
99 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
100 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
101 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
102 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
103 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
104 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
105 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
106 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
107 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
108 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
109 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
111 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
112 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
113 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
114 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
115 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
116 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
117 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
118 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
119 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
120 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
121 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
122 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
123 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
124 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
125 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
126 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
128 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
129 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
130 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
131 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
132 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
133 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
134 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
135 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
136 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
137 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
138 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
139 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
140 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
141 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
142 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
143 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
145 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
146 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
147 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
148 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
149 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
150 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
151 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
152 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
153 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
154 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
155 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
156 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
157 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
158 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
159 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
160 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
170 COMPARE_M_SIMD (a, b, e, f);
172 COMPARE_M_SIMD (b, c, e, f);
174 COMPARE_M_SIMD (c, d, e, f);
178 __kernel void m05100_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)
182 __kernel void m05100_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)
186 __kernel void m05100_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)
192 const u32 lid = get_local_id (0);
198 const u32 gid = get_global_id (0);
200 if (gid >= gid_max) return;
205 pw_buf0[0] = pws[gid].i[0];
206 pw_buf0[1] = pws[gid].i[1];
207 pw_buf0[2] = pws[gid].i[2];
208 pw_buf0[3] = pws[gid].i[3];
209 pw_buf1[0] = pws[gid].i[4];
210 pw_buf1[1] = pws[gid].i[5];
211 pw_buf1[2] = pws[gid].i[6];
212 pw_buf1[3] = pws[gid].i[7];
214 const u32 pw_len = pws[gid].pw_len;
220 const u32 search[4] =
222 digests_buf[digests_offset].digest_buf[DGST_R0],
223 digests_buf[digests_offset].digest_buf[DGST_R1],
224 digests_buf[digests_offset].digest_buf[DGST_R2],
225 digests_buf[digests_offset].digest_buf[DGST_R3]
232 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
239 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
241 append_0x80_2x4_VV (w0, w1, out_len);
255 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
256 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
257 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
258 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
259 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
260 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
261 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
262 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
263 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
264 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
265 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
266 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
267 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
268 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
269 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
270 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
272 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
273 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
274 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
275 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
276 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
277 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
278 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
279 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
280 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
281 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
282 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
283 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
284 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
285 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
286 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
287 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
289 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
290 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
291 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
292 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
293 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
294 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
295 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
296 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
297 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
298 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
299 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
300 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
301 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
302 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
303 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
304 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
306 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
307 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
308 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
309 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
310 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
311 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
312 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
313 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
314 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
315 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
316 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
317 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
318 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
319 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
320 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
321 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
331 COMPARE_S_SIMD (a, b, e, f);
333 COMPARE_S_SIMD (b, c, e, f);
335 COMPARE_S_SIMD (c, d, e, f);
339 __kernel void m05100_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)
343 __kernel void m05100_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)