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 m00900_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);
72 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
73 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
74 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
75 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
76 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
77 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
78 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
79 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
80 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
81 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
82 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
83 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
84 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
85 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
86 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
87 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
89 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
90 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
91 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
92 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
93 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
94 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
95 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
96 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
97 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
98 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
99 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
100 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
101 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
102 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
103 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
104 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
106 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
107 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
108 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
109 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
110 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
111 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
112 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
113 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
114 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
115 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
116 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
117 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
118 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
119 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
120 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
121 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
123 COMPARE_M_SIMD (a, d, c, b);
127 __kernel void m00900_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)
131 __kernel void m00900_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)
135 __kernel void m00900_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)
141 const u32 lid = get_local_id (0);
147 const u32 gid = get_global_id (0);
149 if (gid >= gid_max) return;
154 pw_buf0[0] = pws[gid].i[0];
155 pw_buf0[1] = pws[gid].i[1];
156 pw_buf0[2] = pws[gid].i[2];
157 pw_buf0[3] = pws[gid].i[3];
158 pw_buf1[0] = pws[gid].i[4];
159 pw_buf1[1] = pws[gid].i[5];
160 pw_buf1[2] = pws[gid].i[6];
161 pw_buf1[3] = pws[gid].i[7];
163 const u32 pw_len = pws[gid].pw_len;
169 const u32 search[4] =
171 digests_buf[digests_offset].digest_buf[DGST_R0],
172 digests_buf[digests_offset].digest_buf[DGST_R1],
173 digests_buf[digests_offset].digest_buf[DGST_R2],
174 digests_buf[digests_offset].digest_buf[DGST_R3]
181 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
188 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
190 append_0x80_2x4_VV (w0, w1, out_len);
200 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
201 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
202 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
203 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
204 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
205 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
206 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
207 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
208 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
209 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
210 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
211 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
212 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
213 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
214 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
215 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
217 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
218 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
219 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
220 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
221 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
222 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
223 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
224 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
225 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
226 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
227 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
228 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
229 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
230 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
231 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
232 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
234 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
235 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
236 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
237 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
238 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
239 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
240 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
241 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
242 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
243 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
244 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
245 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
246 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
248 if (MATCHES_NONE_VS (a, search[0])) continue;
250 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
251 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
252 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
254 COMPARE_S_SIMD (a, d, c, b);
258 __kernel void m00900_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)
262 __kernel void m00900_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)