2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
13 #include "include/constants.h"
14 #include "include/kernel_vendor.h"
21 #include "include/kernel_functions.c"
22 #include "OpenCL/types_ocl.c"
23 #include "OpenCL/common.c"
24 #include "OpenCL/simd.c"
27 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i)])
29 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
31 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
33 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3], l_bin2asc[(i).s4], l_bin2asc[(i).s5], l_bin2asc[(i).s6], l_bin2asc[(i).s7])
35 #define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3], l_bin2asc[(i).s4], l_bin2asc[(i).s5], l_bin2asc[(i).s6], l_bin2asc[(i).s7], l_bin2asc[(i).s8], l_bin2asc[(i).s9], l_bin2asc[(i).sa], l_bin2asc[(i).sb], l_bin2asc[(i).sc], l_bin2asc[(i).sd], l_bin2asc[(i).se], l_bin2asc[(i).sf])
38 void sha1_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[5])
66 SHA1_STEP (SHA1_F0o, A, B, C, D, E, w0_t);
67 SHA1_STEP (SHA1_F0o, E, A, B, C, D, w1_t);
68 SHA1_STEP (SHA1_F0o, D, E, A, B, C, w2_t);
69 SHA1_STEP (SHA1_F0o, C, D, E, A, B, w3_t);
70 SHA1_STEP (SHA1_F0o, B, C, D, E, A, w4_t);
71 SHA1_STEP (SHA1_F0o, A, B, C, D, E, w5_t);
72 SHA1_STEP (SHA1_F0o, E, A, B, C, D, w6_t);
73 SHA1_STEP (SHA1_F0o, D, E, A, B, C, w7_t);
74 SHA1_STEP (SHA1_F0o, C, D, E, A, B, w8_t);
75 SHA1_STEP (SHA1_F0o, B, C, D, E, A, w9_t);
76 SHA1_STEP (SHA1_F0o, A, B, C, D, E, wa_t);
77 SHA1_STEP (SHA1_F0o, E, A, B, C, D, wb_t);
78 SHA1_STEP (SHA1_F0o, D, E, A, B, C, wc_t);
79 SHA1_STEP (SHA1_F0o, C, D, E, A, B, wd_t);
80 SHA1_STEP (SHA1_F0o, B, C, D, E, A, we_t);
81 SHA1_STEP (SHA1_F0o, A, B, C, D, E, wf_t);
82 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F0o, E, A, B, C, D, w0_t);
83 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F0o, D, E, A, B, C, w1_t);
84 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F0o, C, D, E, A, B, w2_t);
85 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F0o, B, C, D, E, A, w3_t);
90 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w4_t);
91 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w5_t);
92 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w6_t);
93 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w7_t);
94 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w8_t);
95 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w9_t);
96 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wa_t);
97 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, wb_t);
98 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, wc_t);
99 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wd_t);
100 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, we_t);
101 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wf_t);
102 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w0_t);
103 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w1_t);
104 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w2_t);
105 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w3_t);
106 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w4_t);
107 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w5_t);
108 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w6_t);
109 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w7_t);
114 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w8_t);
115 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w9_t);
116 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, wa_t);
117 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, wb_t);
118 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, wc_t);
119 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, wd_t);
120 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, we_t);
121 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, wf_t);
122 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, w0_t);
123 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, w1_t);
124 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w2_t);
125 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w3_t);
126 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, w4_t);
127 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, w5_t);
128 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, w6_t);
129 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F2o, A, B, C, D, E, w7_t);
130 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F2o, E, A, B, C, D, w8_t);
131 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F2o, D, E, A, B, C, w9_t);
132 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F2o, C, D, E, A, B, wa_t);
133 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F2o, B, C, D, E, A, wb_t);
138 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, wc_t);
139 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wd_t);
140 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, we_t);
141 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, wf_t);
142 w0_t = rotl32 ((wd_t ^ w8_t ^ w2_t ^ w0_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w0_t);
143 w1_t = rotl32 ((we_t ^ w9_t ^ w3_t ^ w1_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w1_t);
144 w2_t = rotl32 ((wf_t ^ wa_t ^ w4_t ^ w2_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w2_t);
145 w3_t = rotl32 ((w0_t ^ wb_t ^ w5_t ^ w3_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w3_t);
146 w4_t = rotl32 ((w1_t ^ wc_t ^ w6_t ^ w4_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w4_t);
147 w5_t = rotl32 ((w2_t ^ wd_t ^ w7_t ^ w5_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, w5_t);
148 w6_t = rotl32 ((w3_t ^ we_t ^ w8_t ^ w6_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, w6_t);
149 w7_t = rotl32 ((w4_t ^ wf_t ^ w9_t ^ w7_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, w7_t);
150 w8_t = rotl32 ((w5_t ^ w0_t ^ wa_t ^ w8_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, w8_t);
151 w9_t = rotl32 ((w6_t ^ w1_t ^ wb_t ^ w9_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, w9_t);
152 wa_t = rotl32 ((w7_t ^ w2_t ^ wc_t ^ wa_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wa_t);
153 wb_t = rotl32 ((w8_t ^ w3_t ^ wd_t ^ wb_t), 1u); SHA1_STEP (SHA1_F1, A, B, C, D, E, wb_t);
154 wc_t = rotl32 ((w9_t ^ w4_t ^ we_t ^ wc_t), 1u); SHA1_STEP (SHA1_F1, E, A, B, C, D, wc_t);
155 wd_t = rotl32 ((wa_t ^ w5_t ^ wf_t ^ wd_t), 1u); SHA1_STEP (SHA1_F1, D, E, A, B, C, wd_t);
156 we_t = rotl32 ((wb_t ^ w6_t ^ w0_t ^ we_t), 1u); SHA1_STEP (SHA1_F1, C, D, E, A, B, we_t);
157 wf_t = rotl32 ((wc_t ^ w7_t ^ w1_t ^ wf_t), 1u); SHA1_STEP (SHA1_F1, B, C, D, E, A, wf_t);
166 void m08400m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __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, __local u32 *l_bin2asc)
172 const u32 gid = get_global_id (0);
173 const u32 lid = get_local_id (0);
183 salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
184 salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
185 salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
186 salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
187 salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
188 salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
189 salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
190 salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
191 salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
192 salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
196 const u32 salt_len = salt_bufs[salt_pos].salt_len;
204 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
206 const u32x w0r = ix_create_bft (bfs_buf, il_pos);
208 const u32x w0lr = w0l | w0r;
230 w3_t[3] = pw_len * 8;
244 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
258 w0_t[0] = salt_buf0[0];
259 w0_t[1] = salt_buf0[1];
260 w0_t[2] = salt_buf0[2];
261 w0_t[3] = salt_buf0[3];
262 w1_t[0] = salt_buf1[0];
263 w1_t[1] = salt_buf1[1];
264 w1_t[2] = salt_buf1[2];
265 w1_t[3] = salt_buf1[3];
266 w2_t[0] = salt_buf2[0];
267 w2_t[1] = salt_buf2[1];
268 w2_t[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
269 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
270 w2_t[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
271 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
272 w3_t[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
273 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
274 w3_t[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
275 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
276 w3_t[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
277 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
278 w3_t[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
279 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
287 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
289 w0_t[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
290 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
291 w0_t[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
292 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
293 w0_t[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
294 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
295 w0_t[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
296 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
297 w1_t[0] = 0x80000000;
308 w3_t[3] = (salt_len + 40) * 8;
310 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
318 w0_t[0] = salt_buf0[0];
319 w0_t[1] = salt_buf0[1];
320 w0_t[2] = salt_buf0[2];
321 w0_t[3] = salt_buf0[3];
322 w1_t[0] = salt_buf1[0];
323 w1_t[1] = salt_buf1[1];
324 w1_t[2] = salt_buf1[2];
325 w1_t[3] = salt_buf1[3];
326 w2_t[0] = salt_buf2[0];
327 w2_t[1] = salt_buf2[1];
328 w2_t[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
329 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
330 w2_t[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
331 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
332 w3_t[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
333 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
334 w3_t[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
335 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
336 w3_t[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
337 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
338 w3_t[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
339 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
347 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
349 w0_t[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
350 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
351 w0_t[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
352 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
353 w0_t[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
354 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
355 w0_t[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
356 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
357 w1_t[0] = 0x80000000;
368 w3_t[3] = (salt_len + 40) * 8;
370 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
372 COMPARE_M_SIMD (digest[3], digest[4], digest[2], digest[1]);
376 void m08400s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __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, __local u32 *l_bin2asc)
382 const u32 gid = get_global_id (0);
383 const u32 lid = get_local_id (0);
393 salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
394 salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
395 salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
396 salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
397 salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
398 salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
399 salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
400 salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
401 salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
402 salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
406 const u32 salt_len = salt_bufs[salt_pos].salt_len;
412 const u32 search[4] =
414 digests_buf[digests_offset].digest_buf[DGST_R0],
415 digests_buf[digests_offset].digest_buf[DGST_R1],
416 digests_buf[digests_offset].digest_buf[DGST_R2],
417 digests_buf[digests_offset].digest_buf[DGST_R3]
426 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
428 const u32x w0r = ix_create_bft (bfs_buf, il_pos);
430 const u32x w0lr = w0l | w0r;
452 w3_t[3] = pw_len * 8;
466 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
480 w0_t[0] = salt_buf0[0];
481 w0_t[1] = salt_buf0[1];
482 w0_t[2] = salt_buf0[2];
483 w0_t[3] = salt_buf0[3];
484 w1_t[0] = salt_buf1[0];
485 w1_t[1] = salt_buf1[1];
486 w1_t[2] = salt_buf1[2];
487 w1_t[3] = salt_buf1[3];
488 w2_t[0] = salt_buf2[0];
489 w2_t[1] = salt_buf2[1];
490 w2_t[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
491 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
492 w2_t[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
493 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
494 w3_t[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
495 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
496 w3_t[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
497 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
498 w3_t[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
499 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
500 w3_t[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
501 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
509 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
511 w0_t[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
512 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
513 w0_t[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
514 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
515 w0_t[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
516 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
517 w0_t[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
518 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
519 w1_t[0] = 0x80000000;
530 w3_t[3] = (salt_len + 40) * 8;
532 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
540 w0_t[0] = salt_buf0[0];
541 w0_t[1] = salt_buf0[1];
542 w0_t[2] = salt_buf0[2];
543 w0_t[3] = salt_buf0[3];
544 w1_t[0] = salt_buf1[0];
545 w1_t[1] = salt_buf1[1];
546 w1_t[2] = salt_buf1[2];
547 w1_t[3] = salt_buf1[3];
548 w2_t[0] = salt_buf2[0];
549 w2_t[1] = salt_buf2[1];
550 w2_t[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
551 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
552 w2_t[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
553 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
554 w3_t[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
555 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
556 w3_t[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
557 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
558 w3_t[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
559 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
560 w3_t[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
561 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
569 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
571 w0_t[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
572 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
573 w0_t[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
574 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
575 w0_t[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
576 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
577 w0_t[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
578 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
579 w1_t[0] = 0x80000000;
590 w3_t[3] = (salt_len + 40) * 8;
592 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
594 COMPARE_S_SIMD (digest[3], digest[4], digest[2], digest[1]);
598 __kernel void m08400_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 *ss, __global void *ess, __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)
604 const u32 gid = get_global_id (0);
605 const u32 lid = get_local_id (0);
606 const u32 lsz = get_local_size (0);
612 __local u32 l_bin2asc[256];
614 for (u32 i = lid; i < 256; i += lsz)
616 const u32 i0 = (i >> 0) & 15;
617 const u32 i1 = (i >> 4) & 15;
619 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
620 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
623 barrier (CLK_LOCAL_MEM_FENCE);
625 if (gid >= gid_max) return;
633 w0[0] = pws[gid].i[ 0];
634 w0[1] = pws[gid].i[ 1];
635 w0[2] = pws[gid].i[ 2];
636 w0[3] = pws[gid].i[ 3];
659 const u32 pw_len = pws[gid].pw_len;
665 m08400m (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, ss, ess, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, l_bin2asc);
668 __kernel void m08400_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 *ss, __global void *ess, __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)
674 const u32 gid = get_global_id (0);
675 const u32 lid = get_local_id (0);
676 const u32 lsz = get_local_size (0);
682 __local u32 l_bin2asc[256];
684 for (u32 i = lid; i < 256; i += lsz)
686 const u32 i0 = (i >> 0) & 15;
687 const u32 i1 = (i >> 4) & 15;
689 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
690 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
693 barrier (CLK_LOCAL_MEM_FENCE);
695 if (gid >= gid_max) return;
703 w0[0] = pws[gid].i[ 0];
704 w0[1] = pws[gid].i[ 1];
705 w0[2] = pws[gid].i[ 2];
706 w0[3] = pws[gid].i[ 3];
710 w1[0] = pws[gid].i[ 4];
711 w1[1] = pws[gid].i[ 5];
712 w1[2] = pws[gid].i[ 6];
713 w1[3] = pws[gid].i[ 7];
729 const u32 pw_len = pws[gid].pw_len;
735 m08400m (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, ss, ess, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, l_bin2asc);
738 __kernel void m08400_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 *ss, __global void *ess, __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)
744 const u32 gid = get_global_id (0);
745 const u32 lid = get_local_id (0);
746 const u32 lsz = get_local_size (0);
752 __local u32 l_bin2asc[256];
754 for (u32 i = lid; i < 256; i += lsz)
756 const u32 i0 = (i >> 0) & 15;
757 const u32 i1 = (i >> 4) & 15;
759 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
760 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
763 barrier (CLK_LOCAL_MEM_FENCE);
765 if (gid >= gid_max) return;
773 w0[0] = pws[gid].i[ 0];
774 w0[1] = pws[gid].i[ 1];
775 w0[2] = pws[gid].i[ 2];
776 w0[3] = pws[gid].i[ 3];
780 w1[0] = pws[gid].i[ 4];
781 w1[1] = pws[gid].i[ 5];
782 w1[2] = pws[gid].i[ 6];
783 w1[3] = pws[gid].i[ 7];
787 w2[0] = pws[gid].i[ 8];
788 w2[1] = pws[gid].i[ 9];
789 w2[2] = pws[gid].i[10];
790 w2[3] = pws[gid].i[11];
794 w3[0] = pws[gid].i[12];
795 w3[1] = pws[gid].i[13];
799 const u32 pw_len = pws[gid].pw_len;
805 m08400m (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, ss, ess, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, l_bin2asc);
808 __kernel void m08400_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 *ss, __global void *ess, __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)
814 const u32 gid = get_global_id (0);
815 const u32 lid = get_local_id (0);
816 const u32 lsz = get_local_size (0);
822 __local u32 l_bin2asc[256];
824 for (u32 i = lid; i < 256; i += lsz)
826 const u32 i0 = (i >> 0) & 15;
827 const u32 i1 = (i >> 4) & 15;
829 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
830 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
833 barrier (CLK_LOCAL_MEM_FENCE);
835 if (gid >= gid_max) return;
843 w0[0] = pws[gid].i[ 0];
844 w0[1] = pws[gid].i[ 1];
845 w0[2] = pws[gid].i[ 2];
846 w0[3] = pws[gid].i[ 3];
869 const u32 pw_len = pws[gid].pw_len;
875 m08400s (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, ss, ess, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, l_bin2asc);
878 __kernel void m08400_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 *ss, __global void *ess, __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)
884 const u32 gid = get_global_id (0);
885 const u32 lid = get_local_id (0);
886 const u32 lsz = get_local_size (0);
892 __local u32 l_bin2asc[256];
894 for (u32 i = lid; i < 256; i += lsz)
896 const u32 i0 = (i >> 0) & 15;
897 const u32 i1 = (i >> 4) & 15;
899 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
900 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
903 barrier (CLK_LOCAL_MEM_FENCE);
905 if (gid >= gid_max) return;
913 w0[0] = pws[gid].i[ 0];
914 w0[1] = pws[gid].i[ 1];
915 w0[2] = pws[gid].i[ 2];
916 w0[3] = pws[gid].i[ 3];
920 w1[0] = pws[gid].i[ 4];
921 w1[1] = pws[gid].i[ 5];
922 w1[2] = pws[gid].i[ 6];
923 w1[3] = pws[gid].i[ 7];
939 const u32 pw_len = pws[gid].pw_len;
945 m08400s (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, ss, ess, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, l_bin2asc);
948 __kernel void m08400_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 *ss, __global void *ess, __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)
954 const u32 gid = get_global_id (0);
955 const u32 lid = get_local_id (0);
956 const u32 lsz = get_local_size (0);
962 __local u32 l_bin2asc[256];
964 for (u32 i = lid; i < 256; i += lsz)
966 const u32 i0 = (i >> 0) & 15;
967 const u32 i1 = (i >> 4) & 15;
969 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
970 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
973 barrier (CLK_LOCAL_MEM_FENCE);
975 if (gid >= gid_max) return;
983 w0[0] = pws[gid].i[ 0];
984 w0[1] = pws[gid].i[ 1];
985 w0[2] = pws[gid].i[ 2];
986 w0[3] = pws[gid].i[ 3];
990 w1[0] = pws[gid].i[ 4];
991 w1[1] = pws[gid].i[ 5];
992 w1[2] = pws[gid].i[ 6];
993 w1[3] = pws[gid].i[ 7];
997 w2[0] = pws[gid].i[ 8];
998 w2[1] = pws[gid].i[ 9];
999 w2[2] = pws[gid].i[10];
1000 w2[3] = pws[gid].i[11];
1004 w3[0] = pws[gid].i[12];
1005 w3[1] = pws[gid].i[13];
1009 const u32 pw_len = pws[gid].pw_len;
1015 m08400s (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, ss, ess, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset, l_bin2asc);