2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "inc_vendor.cl"
11 #include "inc_hash_constants.h"
12 #include "inc_hash_functions.cl"
13 #include "inc_types.cl"
14 #include "inc_common.cl"
17 #include "inc_simd.cl"
19 __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)
25 const u32 lid = get_local_id (0);
31 const u32 gid = get_global_id (0);
33 if (gid >= gid_max) return;
38 pw_buf0[0] = pws[gid].i[0];
39 pw_buf0[1] = pws[gid].i[1];
40 pw_buf0[2] = pws[gid].i[2];
41 pw_buf0[3] = pws[gid].i[3];
42 pw_buf1[0] = pws[gid].i[4];
43 pw_buf1[1] = pws[gid].i[5];
44 pw_buf1[2] = pws[gid].i[6];
45 pw_buf1[3] = pws[gid].i[7];
47 const u32 pw_len = pws[gid].pw_len;
53 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
60 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
62 append_0x80_2x4_VV (w0, w1, out_len);
76 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
77 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
78 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
79 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
80 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
81 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
82 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
83 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
84 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
85 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
86 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
87 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
88 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
89 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
90 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
91 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
93 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
94 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
95 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
96 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
97 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
98 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
99 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
100 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
101 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
102 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
103 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
104 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
105 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
106 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
107 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
108 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
110 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
111 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
112 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
113 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
114 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
115 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
116 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
117 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
118 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
119 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
120 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
121 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
122 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
123 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
124 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
125 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
127 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
128 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
129 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
130 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
131 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
132 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
133 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
134 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
135 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
136 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
137 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
138 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
139 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
140 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
141 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
142 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
151 COMPARE_M_SIMD (a, b, z, z);
152 COMPARE_M_SIMD (b, c, z, z);
153 COMPARE_M_SIMD (c, d, z, z);
157 __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)
161 __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)
165 __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)
171 const u32 lid = get_local_id (0);
177 const u32 gid = get_global_id (0);
179 if (gid >= gid_max) return;
184 pw_buf0[0] = pws[gid].i[0];
185 pw_buf0[1] = pws[gid].i[1];
186 pw_buf0[2] = pws[gid].i[2];
187 pw_buf0[3] = pws[gid].i[3];
188 pw_buf1[0] = pws[gid].i[4];
189 pw_buf1[1] = pws[gid].i[5];
190 pw_buf1[2] = pws[gid].i[6];
191 pw_buf1[3] = pws[gid].i[7];
193 const u32 pw_len = pws[gid].pw_len;
199 const u32 search[4] =
201 digests_buf[digests_offset].digest_buf[DGST_R0],
202 digests_buf[digests_offset].digest_buf[DGST_R1],
211 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
218 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
220 append_0x80_2x4_VV (w0, w1, out_len);
234 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
235 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
236 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
237 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
238 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
239 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
240 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
241 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
242 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
243 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
244 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
245 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
246 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
247 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
248 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
249 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
251 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
252 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
253 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
254 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
255 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
256 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
257 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
258 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
259 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
260 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
261 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
262 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
263 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
264 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
265 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
266 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
268 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
269 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
270 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
271 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
272 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
273 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
274 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
275 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
276 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
277 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
278 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
279 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
280 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
281 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
282 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
283 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
285 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
286 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
287 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
288 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
289 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
290 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
291 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
292 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
293 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
294 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
295 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
296 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
297 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
298 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
299 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
300 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
309 COMPARE_S_SIMD (a, b, z, z);
310 COMPARE_S_SIMD (b, c, z, z);
311 COMPARE_S_SIMD (c, d, z, z);
315 __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)
319 __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)