Fix path to includes
[hashcat.git] / OpenCL / m00900_a0.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD4_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #define DGST_R0 0
12 #define DGST_R1 3
13 #define DGST_R2 2
14 #define DGST_R3 1
15
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19 #include "include/rp_gpu.h"
20 #include "OpenCL/rp.c"
21
22 #define COMPARE_S "OpenCL/check_single_comp4.c"
23 #define COMPARE_M "OpenCL/check_multi_comp4.c"
24
25 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_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)
26 {
27   /**
28    * modifier
29    */
30
31   const u32 lid = get_local_id (0);
32
33   /**
34    * base
35    */
36
37   const u32 gid = get_global_id (0);
38
39   if (gid >= gid_max) return;
40
41   u32 pw_buf0[4];
42
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];
47
48   u32 pw_buf1[4];
49
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];
54
55   const u32 pw_len = pws[gid].pw_len;
56
57   /**
58    * loop
59    */
60
61   for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
62   {
63     u32 w0[4];
64
65     w0[0] = pw_buf0[0];
66     w0[1] = pw_buf0[1];
67     w0[2] = pw_buf0[2];
68     w0[3] = pw_buf0[3];
69
70     u32 w1[4];
71
72     w1[0] = pw_buf1[0];
73     w1[1] = pw_buf1[1];
74     w1[2] = pw_buf1[2];
75     w1[3] = pw_buf1[3];
76
77     u32 w2[4];
78
79     w2[0] = 0;
80     w2[1] = 0;
81     w2[2] = 0;
82     w2[3] = 0;
83
84     u32 w3[4];
85
86     w3[0] = 0;
87     w3[1] = 0;
88     w3[2] = 0;
89     w3[3] = 0;
90
91     const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
92
93     append_0x80_2x4 (w0, w1, out_len);
94
95     w3[2] = out_len * 8;
96
97     u32 a = MD4M_A;
98     u32 b = MD4M_B;
99     u32 c = MD4M_C;
100     u32 d = MD4M_D;
101
102     MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
103     MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
104     MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
105     MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
106     MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
107     MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
108     MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
109     MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
110     MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
111     MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
112     MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
113     MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
114     MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
115     MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
116     MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
117     MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
118
119     MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
120     MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
121     MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
122     MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
123     MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
124     MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
125     MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
126     MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
127     MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
128     MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
129     MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
130     MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
131     MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
132     MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
133     MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
134     MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
135
136     MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
137     MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
138     MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
139     MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
140     MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
141     MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
142     MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
143     MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
144     MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
145     MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
146     MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
147     MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
148     MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
149     MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
150     MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
151     MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
152
153     const u32 r0 = a;
154     const u32 r1 = d;
155     const u32 r2 = c;
156     const u32 r3 = b;
157
158     #include COMPARE_M
159   }
160 }
161
162 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_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)
163 {
164 }
165
166 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_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)
167 {
168 }
169
170 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_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)
171 {
172   /**
173    * modifier
174    */
175
176   const u32 lid = get_local_id (0);
177
178   /**
179    * base
180    */
181
182   const u32 gid = get_global_id (0);
183
184   if (gid >= gid_max) return;
185
186   u32 pw_buf0[4];
187
188   pw_buf0[0] = pws[gid].i[ 0];
189   pw_buf0[1] = pws[gid].i[ 1];
190   pw_buf0[2] = pws[gid].i[ 2];
191   pw_buf0[3] = pws[gid].i[ 3];
192
193   u32 pw_buf1[4];
194
195   pw_buf1[0] = pws[gid].i[ 4];
196   pw_buf1[1] = pws[gid].i[ 5];
197   pw_buf1[2] = pws[gid].i[ 6];
198   pw_buf1[3] = pws[gid].i[ 7];
199
200   const u32 pw_len = pws[gid].pw_len;
201
202   /**
203    * digest
204    */
205
206   const u32 search[4] =
207   {
208     digests_buf[digests_offset].digest_buf[DGST_R0],
209     digests_buf[digests_offset].digest_buf[DGST_R1],
210     digests_buf[digests_offset].digest_buf[DGST_R2],
211     digests_buf[digests_offset].digest_buf[DGST_R3]
212   };
213
214   /**
215    * loop
216    */
217
218   for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
219   {
220     u32 w0[4];
221
222     w0[0] = pw_buf0[0];
223     w0[1] = pw_buf0[1];
224     w0[2] = pw_buf0[2];
225     w0[3] = pw_buf0[3];
226
227     u32 w1[4];
228
229     w1[0] = pw_buf1[0];
230     w1[1] = pw_buf1[1];
231     w1[2] = pw_buf1[2];
232     w1[3] = pw_buf1[3];
233
234     u32 w2[4];
235
236     w2[0] = 0;
237     w2[1] = 0;
238     w2[2] = 0;
239     w2[3] = 0;
240
241     u32 w3[4];
242
243     w3[0] = 0;
244     w3[1] = 0;
245     w3[2] = 0;
246     w3[3] = 0;
247
248     const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
249
250     append_0x80_2x4 (w0, w1, out_len);
251
252     w3[2] = out_len * 8;
253
254     u32 a = MD4M_A;
255     u32 b = MD4M_B;
256     u32 c = MD4M_C;
257     u32 d = MD4M_D;
258
259     MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
260     MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
261     MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
262     MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
263     MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
264     MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
265     MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
266     MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
267     MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
268     MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
269     MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
270     MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
271     MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
272     MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
273     MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
274     MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
275
276     MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
277     MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
278     MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
279     MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
280     MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
281     MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
282     MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
283     MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
284     MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
285     MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
286     MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
287     MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
288     MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
289     MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
290     MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
291     MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
292
293     MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
294     MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
295     MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
296     MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
297     MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
298     MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
299     MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
300     MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
301     MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
302     MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
303     MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
304     MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
305     MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
306     MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
307     MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
308     MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
309
310     const u32 r0 = a;
311     const u32 r1 = d;
312     const u32 r2 = c;
313     const u32 r3 = b;
314
315     #include COMPARE_S
316   }
317 }
318
319 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_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)
320 {
321 }
322
323 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00900_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)
324 {
325 }