- Dropped all vector code since new GPU's are all scalar, makes the code much easier
[hashcat.git] / OpenCL / m08100_a3.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _SHA1_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #define DGST_R0 3
12 #define DGST_R1 4
13 #define DGST_R2 2
14 #define DGST_R3 1
15
16 #include "include/kernel_functions.c"
17 #include "types_ocl.c"
18 #include "common.c"
19
20 #define COMPARE_S "check_single_comp4.c"
21 #define COMPARE_M "check_multi_comp4.c"
22
23 static void m08100m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
24 {
25   /**
26    * modifier
27    */
28
29   const u32 gid = get_global_id (0);
30   const u32 lid = get_local_id (0);
31
32   /**
33    * salt
34    */
35
36   u32 salt_buf0[2];
37
38   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
39   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
40
41   const u32 salt_len = salt_bufs[salt_pos].salt_len;
42
43   const u32 pw_salt_len = pw_len + salt_len;
44
45   /**
46    * loop
47    */
48
49   u32 w0l = w0[0];
50
51   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
52   {
53     const u32 w0r = bfs_buf[il_pos].i;
54
55     w0[0] = w0l | w0r;
56
57     /**
58      * prepend salt
59      */
60
61     u32 w0_t[4];
62     u32 w1_t[4];
63     u32 w2_t[4];
64     u32 w3_t[4];
65
66     w0_t[0] = salt_buf0[0];
67     w0_t[1] = salt_buf0[1];
68     w0_t[2] = w0[0];
69     w0_t[3] = w0[1];
70     w1_t[0] = w0[2];
71     w1_t[1] = w0[3];
72     w1_t[2] = w1[0];
73     w1_t[3] = w1[1];
74     w2_t[0] = w1[2];
75     w2_t[1] = w1[3];
76     w2_t[2] = w2[0];
77     w2_t[3] = w2[1];
78     w3_t[0] = w2[2];
79     w3_t[1] = w2[3];
80     w3_t[2] = 0;
81     w3_t[3] = (pw_salt_len + 1) * 8;
82
83     /**
84      * sha1
85      */
86
87     u32 a = SHA1M_A;
88     u32 b = SHA1M_B;
89     u32 c = SHA1M_C;
90     u32 d = SHA1M_D;
91     u32 e = SHA1M_E;
92
93     #undef K
94     #define K SHA1C00
95
96     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t[0]);
97     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t[1]);
98     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w0_t[2]);
99     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w0_t[3]);
100     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w1_t[0]);
101     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w1_t[1]);
102     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t[2]);
103     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t[3]);
104     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t[0]);
105     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w2_t[1]);
106     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w2_t[2]);
107     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w2_t[3]);
108     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w3_t[0]);
109     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t[1]);
110     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t[2]);
111     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w3_t[3]);
112     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t[0]);
113     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w0_t[1]);
114     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w0_t[2]);
115     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w0_t[3]);
116
117     #undef K
118     #define K SHA1C01
119
120     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t[0]);
121     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[1]);
122     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w1_t[2]);
123     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[3]);
124     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t[0]);
125     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w2_t[1]);
126     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t[2]);
127     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w2_t[3]);
128     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[0]);
129     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w3_t[1]);
130     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t[2]);
131     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[3]);
132     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t[0]);
133     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w0_t[1]);
134     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t[2]);
135     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w0_t[3]);
136     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[0]);
137     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w1_t[1]);
138     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[2]);
139     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w1_t[3]);
140
141     #undef K
142     #define K SHA1C02
143
144     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t[0]);
145     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w2_t[1]);
146     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w2_t[2]);
147     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w2_t[3]);
148     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w3_t[0]);
149     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w3_t[1]);
150     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t[2]);
151     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w3_t[3]);
152     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t[0]);
153     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w0_t[1]);
154     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w0_t[2]);
155     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w0_t[3]);
156     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w1_t[0]);
157     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w1_t[1]);
158     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t[2]);
159     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w1_t[3]);
160     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w2_t[0]);
161     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w2_t[1]);
162     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w2_t[2]);
163     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w2_t[3]);
164
165     #undef K
166     #define K SHA1C03
167
168     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t[0]);
169     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[1]);
170     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t[2]);
171     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[3]);
172     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t[0]);
173     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w0_t[1]);
174     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w0_t[2]);
175     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t[3]);
176     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[0]);
177     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w1_t[1]);
178     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t[2]);
179     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[3]);
180     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w2_t[0]);
181     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w2_t[1]);
182     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t[2]);
183     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w2_t[3]);
184     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[0]);
185     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t[1]);
186     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[2]);
187     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w3_t[3]);
188
189     const u32 r0 = d;
190     const u32 r1 = e;
191     const u32 r2 = c;
192     const u32 r3 = b;
193
194     #include COMPARE_M
195   }
196 }
197
198 static void m08100s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
199 {
200   /**
201    * modifier
202    */
203
204   const u32 gid = get_global_id (0);
205   const u32 lid = get_local_id (0);
206
207   /**
208    * digest
209    */
210
211   const u32 search[4] =
212   {
213     digests_buf[digests_offset].digest_buf[DGST_R0],
214     digests_buf[digests_offset].digest_buf[DGST_R1],
215     digests_buf[digests_offset].digest_buf[DGST_R2],
216     digests_buf[digests_offset].digest_buf[DGST_R3]
217   };
218
219   /**
220    * reverse
221    */
222
223   const u32 e_rev = rotl32 (search[1], 2u);
224
225   /**
226    * salt
227    */
228
229   u32 salt_buf0[2];
230
231   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
232   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
233
234   const u32 salt_len = salt_bufs[salt_pos].salt_len;
235
236   const u32 pw_salt_len = pw_len + salt_len;
237
238   /**
239    * loop
240    */
241
242   u32 w0l = w0[0];
243
244   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
245   {
246     const u32 w0r = bfs_buf[il_pos].i;
247
248     w0[0] = w0l | w0r;
249
250     /**
251      * prepend salt
252      */
253
254     u32 w0_t[4];
255     u32 w1_t[4];
256     u32 w2_t[4];
257     u32 w3_t[4];
258
259     w0_t[0] = salt_buf0[0];
260     w0_t[1] = salt_buf0[1];
261     w0_t[2] = w0[0];
262     w0_t[3] = w0[1];
263     w1_t[0] = w0[2];
264     w1_t[1] = w0[3];
265     w1_t[2] = w1[0];
266     w1_t[3] = w1[1];
267     w2_t[0] = w1[2];
268     w2_t[1] = w1[3];
269     w2_t[2] = w2[0];
270     w2_t[3] = w2[1];
271     w3_t[0] = w2[2];
272     w3_t[1] = w2[3];
273     w3_t[2] = 0;
274     w3_t[3] = (pw_salt_len + 1) * 8;
275
276     /**
277      * sha1
278      */
279
280     u32 a = SHA1M_A;
281     u32 b = SHA1M_B;
282     u32 c = SHA1M_C;
283     u32 d = SHA1M_D;
284     u32 e = SHA1M_E;
285
286     #undef K
287     #define K SHA1C00
288
289     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0_t[0]);
290     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t[1]);
291     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w0_t[2]);
292     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w0_t[3]);
293     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w1_t[0]);
294     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w1_t[1]);
295     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1_t[2]);
296     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1_t[3]);
297     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2_t[0]);
298     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w2_t[1]);
299     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w2_t[2]);
300     SHA1_STEP (SHA1_F0o, e, a, b, c, d, w2_t[3]);
301     SHA1_STEP (SHA1_F0o, d, e, a, b, c, w3_t[0]);
302     SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3_t[1]);
303     SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3_t[2]);
304     SHA1_STEP (SHA1_F0o, a, b, c, d, e, w3_t[3]);
305     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0_t[0]);
306     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w0_t[1]);
307     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w0_t[2]);
308     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w0_t[3]);
309
310     #undef K
311     #define K SHA1C01
312
313     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t[0]);
314     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[1]);
315     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w1_t[2]);
316     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[3]);
317     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t[0]);
318     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w2_t[1]);
319     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2_t[2]);
320     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w2_t[3]);
321     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[0]);
322     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w3_t[1]);
323     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t[2]);
324     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[3]);
325     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t[0]);
326     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w0_t[1]);
327     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t[2]);
328     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w0_t[3]);
329     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[0]);
330     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w1_t[1]);
331     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[2]);
332     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w1_t[3]);
333
334     #undef K
335     #define K SHA1C02
336
337     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2_t[0]);
338     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w2_t[1]);
339     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w2_t[2]);
340     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w2_t[3]);
341     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w3_t[0]);
342     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w3_t[1]);
343     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3_t[2]);
344     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w3_t[3]);
345     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0_t[0]);
346     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w0_t[1]);
347     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w0_t[2]);
348     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w0_t[3]);
349     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w1_t[0]);
350     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w1_t[1]);
351     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1_t[2]);
352     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w1_t[3]);
353     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w2_t[0]);
354     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w2_t[1]);
355     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w2_t[2]);
356     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w2_t[3]);
357
358     #undef K
359     #define K SHA1C03
360
361     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3_t[0]);
362     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[1]);
363     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t[2]);
364     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[3]);
365     w0_t[0] = rotl32 ((w3_t[1] ^ w2_t[0] ^ w0_t[2] ^ w0_t[0]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0_t[0]);
366     w0_t[1] = rotl32 ((w3_t[2] ^ w2_t[1] ^ w0_t[3] ^ w0_t[1]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w0_t[1]);
367     w0_t[2] = rotl32 ((w3_t[3] ^ w2_t[2] ^ w1_t[0] ^ w0_t[2]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w0_t[2]);
368     w0_t[3] = rotl32 ((w0_t[0] ^ w2_t[3] ^ w1_t[1] ^ w0_t[3]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0_t[3]);
369     w1_t[0] = rotl32 ((w0_t[1] ^ w3_t[0] ^ w1_t[2] ^ w1_t[0]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1_t[0]);
370     w1_t[1] = rotl32 ((w0_t[2] ^ w3_t[1] ^ w1_t[3] ^ w1_t[1]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w1_t[1]);
371     w1_t[2] = rotl32 ((w0_t[3] ^ w3_t[2] ^ w2_t[0] ^ w1_t[2]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1_t[2]);
372     w1_t[3] = rotl32 ((w1_t[0] ^ w3_t[3] ^ w2_t[1] ^ w1_t[3]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w1_t[3]);
373     w2_t[0] = rotl32 ((w1_t[1] ^ w0_t[0] ^ w2_t[2] ^ w2_t[0]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w2_t[0]);
374     w2_t[1] = rotl32 ((w1_t[2] ^ w0_t[1] ^ w2_t[3] ^ w2_t[1]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w2_t[1]);
375     w2_t[2] = rotl32 ((w1_t[3] ^ w0_t[2] ^ w3_t[0] ^ w2_t[2]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2_t[2]);
376     w2_t[3] = rotl32 ((w2_t[0] ^ w0_t[3] ^ w3_t[1] ^ w2_t[3]), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w2_t[3]);
377     w3_t[0] = rotl32 ((w2_t[1] ^ w1_t[0] ^ w3_t[2] ^ w3_t[0]), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w3_t[0]);
378
379     if (allx (e != e_rev)) continue;
380
381     w3_t[1] = rotl32 ((w2_t[2] ^ w1_t[1] ^ w3_t[3] ^ w3_t[1]), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3_t[1]);
382     w3_t[2] = rotl32 ((w2_t[3] ^ w1_t[2] ^ w0_t[0] ^ w3_t[2]), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w3_t[2]);
383     w3_t[3] = rotl32 ((w3_t[0] ^ w1_t[3] ^ w0_t[1] ^ w3_t[3]), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w3_t[3]);
384
385     const u32 r0 = d;
386     const u32 r1 = e;
387     const u32 r2 = c;
388     const u32 r3 = b;
389
390     #include COMPARE_S
391   }
392 }
393
394 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
395 {
396   /**
397    * base
398    */
399
400   const u32 gid = get_global_id (0);
401
402   if (gid >= gid_max) return;
403
404   u32 w0[4];
405
406   w0[0] = pws[gid].i[ 0];
407   w0[1] = pws[gid].i[ 1];
408   w0[2] = pws[gid].i[ 2];
409   w0[3] = pws[gid].i[ 3];
410
411   u32 w1[4];
412
413   w1[0] = 0;
414   w1[1] = 0;
415   w1[2] = 0;
416   w1[3] = 0;
417
418   u32 w2[4];
419
420   w2[0] = 0;
421   w2[1] = 0;
422   w2[2] = 0;
423   w2[3] = 0;
424
425   u32 w3[4];
426
427   w3[0] = 0;
428   w3[1] = 0;
429   w3[2] = 0;
430   w3[3] = 0;
431
432   const u32 pw_len = pws[gid].pw_len;
433
434   /**
435    * base
436    */
437
438   w0[0] = swap_workaround (w0[0]);
439   w0[1] = swap_workaround (w0[1]);
440   w0[2] = swap_workaround (w0[2]);
441   w0[3] = swap_workaround (w0[3]);
442
443   append_0x80_2 (w0, w1, pw_len + 1);
444
445   w0[0] = swap_workaround (w0[0]);
446   w0[1] = swap_workaround (w0[1]);
447   w0[2] = swap_workaround (w0[2]);
448   w0[3] = swap_workaround (w0[3]);
449   w1[0] = swap_workaround (w1[0]);
450
451   /**
452    * main
453    */
454
455   m08100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
456 }
457
458 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
459 {
460   /**
461    * base
462    */
463
464   const u32 gid = get_global_id (0);
465
466   if (gid >= gid_max) return;
467
468   u32 w0[4];
469
470   w0[0] = pws[gid].i[ 0];
471   w0[1] = pws[gid].i[ 1];
472   w0[2] = pws[gid].i[ 2];
473   w0[3] = pws[gid].i[ 3];
474
475   u32 w1[4];
476
477   w1[0] = pws[gid].i[ 4];
478   w1[1] = pws[gid].i[ 5];
479   w1[2] = pws[gid].i[ 6];
480   w1[3] = pws[gid].i[ 7];
481
482   u32 w2[4];
483
484   w2[0] = 0;
485   w2[1] = 0;
486   w2[2] = 0;
487   w2[3] = 0;
488
489   u32 w3[4];
490
491   w3[0] = 0;
492   w3[1] = 0;
493   w3[2] = 0;
494   w3[3] = 0;
495
496   const u32 pw_len = pws[gid].pw_len;
497
498   /**
499    * base
500    */
501
502   w0[0] = swap_workaround (w0[0]);
503   w0[1] = swap_workaround (w0[1]);
504   w0[2] = swap_workaround (w0[2]);
505   w0[3] = swap_workaround (w0[3]);
506   w1[0] = swap_workaround (w1[0]);
507   w1[1] = swap_workaround (w1[1]);
508   w1[2] = swap_workaround (w1[2]);
509   w1[3] = swap_workaround (w1[3]);
510
511   append_0x80_3 (w0, w1, w2, pw_len + 1);
512
513   w0[0] = swap_workaround (w0[0]);
514   w0[1] = swap_workaround (w0[1]);
515   w0[2] = swap_workaround (w0[2]);
516   w0[3] = swap_workaround (w0[3]);
517   w1[0] = swap_workaround (w1[0]);
518   w1[1] = swap_workaround (w1[1]);
519   w1[2] = swap_workaround (w1[2]);
520   w1[3] = swap_workaround (w1[3]);
521   w2[0] = swap_workaround (w2[0]);
522
523   /**
524    * main
525    */
526
527   m08100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
528 }
529
530 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
531 {
532   /**
533    * base
534    */
535
536   const u32 gid = get_global_id (0);
537
538   if (gid >= gid_max) return;
539
540   u32 w0[4];
541
542   w0[0] = pws[gid].i[ 0];
543   w0[1] = pws[gid].i[ 1];
544   w0[2] = pws[gid].i[ 2];
545   w0[3] = pws[gid].i[ 3];
546
547   u32 w1[4];
548
549   w1[0] = pws[gid].i[ 4];
550   w1[1] = pws[gid].i[ 5];
551   w1[2] = pws[gid].i[ 6];
552   w1[3] = pws[gid].i[ 7];
553
554   u32 w2[4];
555
556   w2[0] = pws[gid].i[ 8];
557   w2[1] = pws[gid].i[ 9];
558   w2[2] = pws[gid].i[10];
559   w2[3] = pws[gid].i[11];
560
561   u32 w3[4];
562
563   w3[0] = pws[gid].i[12];
564   w3[1] = pws[gid].i[13];
565   w3[2] = 0;
566   w3[3] = 0;
567
568   const u32 pw_len = pws[gid].pw_len;
569
570   /**
571    * base
572    */
573
574   w0[0] = swap_workaround (w0[0]);
575   w0[1] = swap_workaround (w0[1]);
576   w0[2] = swap_workaround (w0[2]);
577   w0[3] = swap_workaround (w0[3]);
578   w1[0] = swap_workaround (w1[0]);
579   w1[1] = swap_workaround (w1[1]);
580   w1[2] = swap_workaround (w1[2]);
581   w1[3] = swap_workaround (w1[3]);
582   w2[0] = swap_workaround (w2[0]);
583   w2[1] = swap_workaround (w2[1]);
584   w2[2] = swap_workaround (w2[2]);
585   w2[3] = swap_workaround (w2[3]);
586   w3[0] = swap_workaround (w3[0]);
587   w3[1] = swap_workaround (w3[1]);
588   w3[2] = 0;
589   w3[3] = 0;
590
591   append_0x80_4 (w0, w1, w2, w3, pw_len + 1);
592
593   w0[0] = swap_workaround (w0[0]);
594   w0[1] = swap_workaround (w0[1]);
595   w0[2] = swap_workaround (w0[2]);
596   w0[3] = swap_workaround (w0[3]);
597   w1[0] = swap_workaround (w1[0]);
598   w1[1] = swap_workaround (w1[1]);
599   w1[2] = swap_workaround (w1[2]);
600   w1[3] = swap_workaround (w1[3]);
601   w2[0] = swap_workaround (w2[0]);
602   w2[1] = swap_workaround (w2[1]);
603   w2[2] = swap_workaround (w2[2]);
604   w2[3] = swap_workaround (w2[3]);
605   w3[0] = swap_workaround (w3[0]);
606   w3[1] = swap_workaround (w3[1]);
607   w3[2] = 0;
608   w3[3] = 0;
609
610   /**
611    * main
612    */
613
614   m08100m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
615 }
616
617 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
618 {
619   /**
620    * base
621    */
622
623   const u32 gid = get_global_id (0);
624
625   if (gid >= gid_max) return;
626
627   u32 w0[4];
628
629   w0[0] = pws[gid].i[ 0];
630   w0[1] = pws[gid].i[ 1];
631   w0[2] = pws[gid].i[ 2];
632   w0[3] = pws[gid].i[ 3];
633
634   u32 w1[4];
635
636   w1[0] = 0;
637   w1[1] = 0;
638   w1[2] = 0;
639   w1[3] = 0;
640
641   u32 w2[4];
642
643   w2[0] = 0;
644   w2[1] = 0;
645   w2[2] = 0;
646   w2[3] = 0;
647
648   u32 w3[4];
649
650   w3[0] = 0;
651   w3[1] = 0;
652   w3[2] = 0;
653   w3[3] = 0;
654
655   const u32 pw_len = pws[gid].pw_len;
656
657   /**
658    * base
659    */
660
661   w0[0] = swap_workaround (w0[0]);
662   w0[1] = swap_workaround (w0[1]);
663   w0[2] = swap_workaround (w0[2]);
664   w0[3] = swap_workaround (w0[3]);
665
666   append_0x80_2 (w0, w1, pw_len + 1);
667
668   w0[0] = swap_workaround (w0[0]);
669   w0[1] = swap_workaround (w0[1]);
670   w0[2] = swap_workaround (w0[2]);
671   w0[3] = swap_workaround (w0[3]);
672   w1[0] = swap_workaround (w1[0]);
673
674   /**
675    * main
676    */
677
678   m08100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
679 }
680
681 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
682 {
683   /**
684    * base
685    */
686
687   const u32 gid = get_global_id (0);
688
689   if (gid >= gid_max) return;
690
691   u32 w0[4];
692
693   w0[0] = pws[gid].i[ 0];
694   w0[1] = pws[gid].i[ 1];
695   w0[2] = pws[gid].i[ 2];
696   w0[3] = pws[gid].i[ 3];
697
698   u32 w1[4];
699
700   w1[0] = pws[gid].i[ 4];
701   w1[1] = pws[gid].i[ 5];
702   w1[2] = pws[gid].i[ 6];
703   w1[3] = pws[gid].i[ 7];
704
705   u32 w2[4];
706
707   w2[0] = 0;
708   w2[1] = 0;
709   w2[2] = 0;
710   w2[3] = 0;
711
712   u32 w3[4];
713
714   w3[0] = 0;
715   w3[1] = 0;
716   w3[2] = 0;
717   w3[3] = 0;
718
719   const u32 pw_len = pws[gid].pw_len;
720
721   /**
722    * base
723    */
724
725   w0[0] = swap_workaround (w0[0]);
726   w0[1] = swap_workaround (w0[1]);
727   w0[2] = swap_workaround (w0[2]);
728   w0[3] = swap_workaround (w0[3]);
729   w1[0] = swap_workaround (w1[0]);
730   w1[1] = swap_workaround (w1[1]);
731   w1[2] = swap_workaround (w1[2]);
732   w1[3] = swap_workaround (w1[3]);
733
734   append_0x80_3 (w0, w1, w2, pw_len + 1);
735
736   w0[0] = swap_workaround (w0[0]);
737   w0[1] = swap_workaround (w0[1]);
738   w0[2] = swap_workaround (w0[2]);
739   w0[3] = swap_workaround (w0[3]);
740   w1[0] = swap_workaround (w1[0]);
741   w1[1] = swap_workaround (w1[1]);
742   w1[2] = swap_workaround (w1[2]);
743   w1[3] = swap_workaround (w1[3]);
744   w2[0] = swap_workaround (w2[0]);
745
746   /**
747    * main
748    */
749
750   m08100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
751 }
752
753 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m08100_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
754 {
755   /**
756    * base
757    */
758
759   const u32 gid = get_global_id (0);
760
761   if (gid >= gid_max) return;
762
763   u32 w0[4];
764
765   w0[0] = pws[gid].i[ 0];
766   w0[1] = pws[gid].i[ 1];
767   w0[2] = pws[gid].i[ 2];
768   w0[3] = pws[gid].i[ 3];
769
770   u32 w1[4];
771
772   w1[0] = pws[gid].i[ 4];
773   w1[1] = pws[gid].i[ 5];
774   w1[2] = pws[gid].i[ 6];
775   w1[3] = pws[gid].i[ 7];
776
777   u32 w2[4];
778
779   w2[0] = pws[gid].i[ 8];
780   w2[1] = pws[gid].i[ 9];
781   w2[2] = pws[gid].i[10];
782   w2[3] = pws[gid].i[11];
783
784   u32 w3[4];
785
786   w3[0] = pws[gid].i[12];
787   w3[1] = pws[gid].i[13];
788   w3[2] = 0;
789   w3[3] = 0;
790
791   const u32 pw_len = pws[gid].pw_len;
792
793   /**
794    * base
795    */
796
797   w0[0] = swap_workaround (w0[0]);
798   w0[1] = swap_workaround (w0[1]);
799   w0[2] = swap_workaround (w0[2]);
800   w0[3] = swap_workaround (w0[3]);
801   w1[0] = swap_workaround (w1[0]);
802   w1[1] = swap_workaround (w1[1]);
803   w1[2] = swap_workaround (w1[2]);
804   w1[3] = swap_workaround (w1[3]);
805   w2[0] = swap_workaround (w2[0]);
806   w2[1] = swap_workaround (w2[1]);
807   w2[2] = swap_workaround (w2[2]);
808   w2[3] = swap_workaround (w2[3]);
809   w3[0] = swap_workaround (w3[0]);
810   w3[1] = swap_workaround (w3[1]);
811   w3[2] = 0;
812   w3[3] = 0;
813
814   append_0x80_4 (w0, w1, w2, w3, pw_len + 1);
815
816   w0[0] = swap_workaround (w0[0]);
817   w0[1] = swap_workaround (w0[1]);
818   w0[2] = swap_workaround (w0[2]);
819   w0[3] = swap_workaround (w0[3]);
820   w1[0] = swap_workaround (w1[0]);
821   w1[1] = swap_workaround (w1[1]);
822   w1[2] = swap_workaround (w1[2]);
823   w1[3] = swap_workaround (w1[3]);
824   w2[0] = swap_workaround (w2[0]);
825   w2[1] = swap_workaround (w2[1]);
826   w2[2] = swap_workaround (w2[2]);
827   w2[3] = swap_workaround (w2[3]);
828   w3[0] = swap_workaround (w3[0]);
829   w3[1] = swap_workaround (w3[1]);
830   w3[2] = 0;
831   w3[3] = 0;
832
833   /**
834    * main
835    */
836
837   m08100s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
838 }