2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19 #include "include/rp_kernel.h"
20 #include "OpenCL/rp.c"
22 #define COMPARE_S "OpenCL/check_single_comp4.c"
23 #define COMPARE_M "OpenCL/check_multi_comp4.c"
25 __kernel void m01000_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 rules_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;
43 pw_buf0[0] = pws[gid].i[ 0];
44 pw_buf0[1] = pws[gid].i[ 1];
45 pw_buf0[2] = pws[gid].i[ 2];
46 pw_buf0[3] = pws[gid].i[ 3];
50 pw_buf1[0] = pws[gid].i[ 4];
51 pw_buf1[1] = pws[gid].i[ 5];
52 pw_buf1[2] = pws[gid].i[ 6];
53 pw_buf1[3] = pws[gid].i[ 7];
55 const u32 pw_len = pws[gid].pw_len;
61 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
91 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
93 append_0x80_2x4 (w0, w1, out_len);
100 make_unicode (w0, w0_t, w1_t);
101 make_unicode (w1, w2_t, w3_t);
103 w3_t[2] = out_len * 8 * 2;
112 MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
113 MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
114 MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
115 MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
116 MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
117 MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
118 MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
119 MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
120 MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
121 MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
122 MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
123 MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
124 MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
125 MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
126 MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
127 MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
129 MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
130 MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
131 MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
132 MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
133 MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
134 MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
135 MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
136 MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
137 MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
138 MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
139 MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
140 MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
141 MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
142 MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
143 MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
144 MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
146 MD4_STEP (MD4_H1, a, b, c, d, w0_t[0], MD4C02, MD4S20);
147 MD4_STEP (MD4_H2, d, a, b, c, w2_t[0], MD4C02, MD4S21);
148 MD4_STEP (MD4_H1, c, d, a, b, w1_t[0], MD4C02, MD4S22);
149 MD4_STEP (MD4_H2, b, c, d, a, w3_t[0], MD4C02, MD4S23);
150 MD4_STEP (MD4_H1, a, b, c, d, w0_t[2], MD4C02, MD4S20);
151 MD4_STEP (MD4_H2, d, a, b, c, w2_t[2], MD4C02, MD4S21);
152 MD4_STEP (MD4_H1, c, d, a, b, w1_t[2], MD4C02, MD4S22);
153 MD4_STEP (MD4_H2, b, c, d, a, w3_t[2], MD4C02, MD4S23);
154 MD4_STEP (MD4_H1, a, b, c, d, w0_t[1], MD4C02, MD4S20);
155 MD4_STEP (MD4_H2, d, a, b, c, w2_t[1], MD4C02, MD4S21);
156 MD4_STEP (MD4_H1, c, d, a, b, w1_t[1], MD4C02, MD4S22);
157 MD4_STEP (MD4_H2, b, c, d, a, w3_t[1], MD4C02, MD4S23);
158 MD4_STEP (MD4_H1, a, b, c, d, w0_t[3], MD4C02, MD4S20);
159 MD4_STEP (MD4_H2, d, a, b, c, w2_t[3], MD4C02, MD4S21);
160 MD4_STEP (MD4_H1, c, d, a, b, w1_t[3], MD4C02, MD4S22);
161 MD4_STEP (MD4_H2, b, c, d, a, w3_t[3], MD4C02, MD4S23);
172 __kernel void m01000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
176 __kernel void m01000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
180 __kernel void m01000_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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
186 const u32 lid = get_local_id (0);
192 const u32 gid = get_global_id (0);
194 if (gid >= gid_max) return;
198 pw_buf0[0] = pws[gid].i[ 0];
199 pw_buf0[1] = pws[gid].i[ 1];
200 pw_buf0[2] = pws[gid].i[ 2];
201 pw_buf0[3] = pws[gid].i[ 3];
205 pw_buf1[0] = pws[gid].i[ 4];
206 pw_buf1[1] = pws[gid].i[ 5];
207 pw_buf1[2] = pws[gid].i[ 6];
208 pw_buf1[3] = pws[gid].i[ 7];
210 const u32 pw_len = pws[gid].pw_len;
216 const u32 search[4] =
218 digests_buf[digests_offset].digest_buf[DGST_R0],
219 digests_buf[digests_offset].digest_buf[DGST_R1],
220 digests_buf[digests_offset].digest_buf[DGST_R2],
221 digests_buf[digests_offset].digest_buf[DGST_R3]
228 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
258 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
260 append_0x80_2x4 (w0, w1, out_len);
267 make_unicode (w0, w0_t, w1_t);
268 make_unicode (w1, w2_t, w3_t);
270 w3_t[2] = out_len * 8 * 2;
279 MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
280 MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
281 MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
282 MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
283 MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
284 MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
285 MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
286 MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
287 MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
288 MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
289 MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
290 MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
291 MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
292 MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
293 MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
294 MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
296 MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
297 MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
298 MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
299 MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
300 MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
301 MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
302 MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
303 MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
304 MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
305 MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
306 MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
307 MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
308 MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
309 MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
310 MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
311 MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
313 MD4_STEP (MD4_H1, a, b, c, d, w0_t[0], MD4C02, MD4S20);
314 MD4_STEP (MD4_H2, d, a, b, c, w2_t[0], MD4C02, MD4S21);
315 MD4_STEP (MD4_H1, c, d, a, b, w1_t[0], MD4C02, MD4S22);
316 MD4_STEP (MD4_H2, b, c, d, a, w3_t[0], MD4C02, MD4S23);
317 MD4_STEP (MD4_H1, a, b, c, d, w0_t[2], MD4C02, MD4S20);
318 MD4_STEP (MD4_H2, d, a, b, c, w2_t[2], MD4C02, MD4S21);
319 MD4_STEP (MD4_H1, c, d, a, b, w1_t[2], MD4C02, MD4S22);
320 MD4_STEP (MD4_H2, b, c, d, a, w3_t[2], MD4C02, MD4S23);
321 MD4_STEP (MD4_H1, a, b, c, d, w0_t[1], MD4C02, MD4S20);
322 MD4_STEP (MD4_H2, d, a, b, c, w2_t[1], MD4C02, MD4S21);
323 MD4_STEP (MD4_H1, c, d, a, b, w1_t[1], MD4C02, MD4S22);
324 MD4_STEP (MD4_H2, b, c, d, a, w3_t[1], MD4C02, MD4S23);
325 MD4_STEP (MD4_H1, a, b, c, d, w0_t[3], MD4C02, MD4S20);
326 MD4_STEP (MD4_H2, d, a, b, c, w2_t[3], MD4C02, MD4S21);
327 MD4_STEP (MD4_H1, c, d, a, b, w1_t[3], MD4C02, MD4S22);
328 MD4_STEP (MD4_H2, b, c, d, a, w3_t[3], MD4C02, MD4S23);
339 __kernel void m01000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
343 __kernel void m01000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)