2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
28 #include "include/kernel_functions.c"
29 #include "types_amd.c"
30 #include "common_amd.c"
31 #include "include/rp_gpu.h"
35 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
36 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
40 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
41 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
45 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
46 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
49 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_m04 (__global pw_t *pws, __global gpu_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)
55 const u32 lid = get_local_id (0);
61 const u32 gid = get_global_id (0);
63 if (gid >= gid_max) return;
67 pw_buf0[0] = pws[gid].i[ 0];
68 pw_buf0[1] = pws[gid].i[ 1];
69 pw_buf0[2] = pws[gid].i[ 2];
70 pw_buf0[3] = pws[gid].i[ 3];
74 pw_buf1[0] = pws[gid].i[ 4];
75 pw_buf1[1] = pws[gid].i[ 5];
76 pw_buf1[2] = pws[gid].i[ 6];
77 pw_buf1[3] = pws[gid].i[ 7];
79 const u32 pw_len = pws[gid].pw_len;
85 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
115 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
117 append_0x80_2 (w0, w1, out_len);
124 make_unicode (w0, w0_t, w1_t);
125 make_unicode (w1, w2_t, w3_t);
127 w3_t[2] = out_len * 8 * 2;
136 MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
137 MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
138 MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
139 MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
140 MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
141 MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
142 MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
143 MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
144 MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
145 MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
146 MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
147 MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
148 MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
149 MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
150 MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
151 MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
153 MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
154 MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
155 MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
156 MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
157 MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
158 MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
159 MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
160 MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
161 MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
162 MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
163 MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
164 MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
165 MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
166 MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
167 MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
168 MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
170 MD4_STEP (MD4_H1, a, b, c, d, w0_t[0], MD4C02, MD4S20);
171 MD4_STEP (MD4_H2, d, a, b, c, w2_t[0], MD4C02, MD4S21);
172 MD4_STEP (MD4_H1, c, d, a, b, w1_t[0], MD4C02, MD4S22);
173 MD4_STEP (MD4_H2, b, c, d, a, w3_t[0], MD4C02, MD4S23);
174 MD4_STEP (MD4_H1, a, b, c, d, w0_t[2], MD4C02, MD4S20);
175 MD4_STEP (MD4_H2, d, a, b, c, w2_t[2], MD4C02, MD4S21);
176 MD4_STEP (MD4_H1, c, d, a, b, w1_t[2], MD4C02, MD4S22);
177 MD4_STEP (MD4_H2, b, c, d, a, w3_t[2], MD4C02, MD4S23);
178 MD4_STEP (MD4_H1, a, b, c, d, w0_t[1], MD4C02, MD4S20);
179 MD4_STEP (MD4_H2, d, a, b, c, w2_t[1], MD4C02, MD4S21);
180 MD4_STEP (MD4_H1, c, d, a, b, w1_t[1], MD4C02, MD4S22);
181 MD4_STEP (MD4_H2, b, c, d, a, w3_t[1], MD4C02, MD4S23);
182 MD4_STEP (MD4_H1, a, b, c, d, w0_t[3], MD4C02, MD4S20);
183 MD4_STEP (MD4_H2, d, a, b, c, w2_t[3], MD4C02, MD4S21);
184 MD4_STEP (MD4_H1, c, d, a, b, w1_t[3], MD4C02, MD4S22);
185 MD4_STEP (MD4_H2, b, c, d, a, w3_t[3], MD4C02, MD4S23);
192 #include VECT_COMPARE_M
196 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_m08 (__global pw_t *pws, __global gpu_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)
200 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_m16 (__global pw_t *pws, __global gpu_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)
204 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_s04 (__global pw_t *pws, __global gpu_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)
210 const u32 lid = get_local_id (0);
216 const u32 gid = get_global_id (0);
218 if (gid >= gid_max) return;
222 pw_buf0[0] = pws[gid].i[ 0];
223 pw_buf0[1] = pws[gid].i[ 1];
224 pw_buf0[2] = pws[gid].i[ 2];
225 pw_buf0[3] = pws[gid].i[ 3];
229 pw_buf1[0] = pws[gid].i[ 4];
230 pw_buf1[1] = pws[gid].i[ 5];
231 pw_buf1[2] = pws[gid].i[ 6];
232 pw_buf1[3] = pws[gid].i[ 7];
234 const u32 pw_len = pws[gid].pw_len;
240 const u32 search[4] =
242 digests_buf[digests_offset].digest_buf[DGST_R0],
243 digests_buf[digests_offset].digest_buf[DGST_R1],
244 digests_buf[digests_offset].digest_buf[DGST_R2],
245 digests_buf[digests_offset].digest_buf[DGST_R3]
252 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
282 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
284 append_0x80_2 (w0, w1, out_len);
291 make_unicode (w0, w0_t, w1_t);
292 make_unicode (w1, w2_t, w3_t);
294 w3_t[2] = out_len * 8 * 2;
303 MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
304 MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
305 MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
306 MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
307 MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
308 MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
309 MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
310 MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
311 MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
312 MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
313 MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
314 MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
315 MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
316 MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
317 MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
318 MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
320 MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
321 MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
322 MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
323 MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
324 MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
325 MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
326 MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
327 MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
328 MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
329 MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
330 MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
331 MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
332 MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
333 MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
334 MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
335 MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
337 MD4_STEP (MD4_H1, a, b, c, d, w0_t[0], MD4C02, MD4S20);
338 MD4_STEP (MD4_H2, d, a, b, c, w2_t[0], MD4C02, MD4S21);
339 MD4_STEP (MD4_H1, c, d, a, b, w1_t[0], MD4C02, MD4S22);
340 MD4_STEP (MD4_H2, b, c, d, a, w3_t[0], MD4C02, MD4S23);
341 MD4_STEP (MD4_H1, a, b, c, d, w0_t[2], MD4C02, MD4S20);
342 MD4_STEP (MD4_H2, d, a, b, c, w2_t[2], MD4C02, MD4S21);
343 MD4_STEP (MD4_H1, c, d, a, b, w1_t[2], MD4C02, MD4S22);
344 MD4_STEP (MD4_H2, b, c, d, a, w3_t[2], MD4C02, MD4S23);
345 MD4_STEP (MD4_H1, a, b, c, d, w0_t[1], MD4C02, MD4S20);
346 MD4_STEP (MD4_H2, d, a, b, c, w2_t[1], MD4C02, MD4S21);
347 MD4_STEP (MD4_H1, c, d, a, b, w1_t[1], MD4C02, MD4S22);
348 MD4_STEP (MD4_H2, b, c, d, a, w3_t[1], MD4C02, MD4S23);
349 MD4_STEP (MD4_H1, a, b, c, d, w0_t[3], MD4C02, MD4S20);
350 MD4_STEP (MD4_H2, d, a, b, c, w2_t[3], MD4C02, MD4S21);
351 MD4_STEP (MD4_H1, c, d, a, b, w1_t[3], MD4C02, MD4S22);
352 MD4_STEP (MD4_H2, b, c, d, a, w3_t[3], MD4C02, MD4S23);
359 #include VECT_COMPARE_S
363 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_s08 (__global pw_t *pws, __global gpu_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)
367 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m01000_s16 (__global pw_t *pws, __global gpu_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)