2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "inc_hash_constants.h"
11 #include "inc_vendor.cl"
18 #include "inc_hash_functions.cl"
19 #include "inc_types.cl"
20 #include "inc_common.cl"
23 #include "inc_simd.cl"
25 __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)
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;
59 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
66 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
68 append_0x80_2x4_VV (w0, w1, out_len);
78 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
79 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
80 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
81 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
82 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
83 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
84 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
85 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
86 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
87 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
88 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
89 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
90 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
91 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
92 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
93 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
95 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
96 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
97 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
98 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
99 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
100 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
101 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
102 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
103 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
104 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
105 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
106 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
107 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
108 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
109 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
110 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
112 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
113 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
114 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
115 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
116 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
117 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
118 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
119 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
120 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
121 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
122 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
123 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
124 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
125 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
126 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
127 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
129 COMPARE_M_SIMD (a, d, c, b);
133 __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)
137 __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)
141 __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)
147 const u32 lid = get_local_id (0);
153 const u32 gid = get_global_id (0);
155 if (gid >= gid_max) return;
160 pw_buf0[0] = pws[gid].i[0];
161 pw_buf0[1] = pws[gid].i[1];
162 pw_buf0[2] = pws[gid].i[2];
163 pw_buf0[3] = pws[gid].i[3];
164 pw_buf1[0] = pws[gid].i[4];
165 pw_buf1[1] = pws[gid].i[5];
166 pw_buf1[2] = pws[gid].i[6];
167 pw_buf1[3] = pws[gid].i[7];
169 const u32 pw_len = pws[gid].pw_len;
175 const u32 search[4] =
177 digests_buf[digests_offset].digest_buf[DGST_R0],
178 digests_buf[digests_offset].digest_buf[DGST_R1],
179 digests_buf[digests_offset].digest_buf[DGST_R2],
180 digests_buf[digests_offset].digest_buf[DGST_R3]
187 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
194 const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
196 append_0x80_2x4_VV (w0, w1, out_len);
206 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
207 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
208 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
209 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
210 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
211 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
212 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
213 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
214 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
215 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
216 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
217 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
218 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
219 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
220 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
221 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
223 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
224 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
225 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
226 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
227 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
228 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
229 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
230 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
231 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
232 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
233 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
234 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
235 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
236 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
237 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
238 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
240 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
241 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
242 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
243 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
244 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
245 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
246 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
247 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
248 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
249 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
250 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
251 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
252 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
254 if (MATCHES_NONE_VS (a, search[0])) continue;
256 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
257 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
258 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
260 COMPARE_S_SIMD (a, d, c, b);
264 __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)
268 __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)