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 static 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 static 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);
181 salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
182 salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
183 salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
184 salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
188 salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
189 salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
190 salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
191 salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
195 salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
196 salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
200 const u32 salt_len = salt_bufs[salt_pos].salt_len;
208 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
210 const u32x w0r = ix_create_bft (bfs_buf, il_pos);
212 const u32x w0lr = w0l | w0r;
240 w3_t[3] = pw_len * 8;
250 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
264 w0_t[0] = salt_buf0[0];
265 w0_t[1] = salt_buf0[1];
266 w0_t[2] = salt_buf0[2];
267 w0_t[3] = salt_buf0[3];
268 w1_t[0] = salt_buf1[0];
269 w1_t[1] = salt_buf1[1];
270 w1_t[2] = salt_buf1[2];
271 w1_t[3] = salt_buf1[3];
272 w2_t[0] = salt_buf2[0];
273 w2_t[1] = salt_buf2[1];
274 w2_t[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
275 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
276 w2_t[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
277 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
278 w3_t[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
279 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
280 w3_t[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
281 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
282 w3_t[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
283 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
284 w3_t[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
285 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
293 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
295 w0_t[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
296 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
297 w0_t[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
298 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
299 w0_t[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
300 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
301 w0_t[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
302 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
303 w1_t[0] = 0x80000000;
316 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
324 w0_t[0] = salt_buf0[0];
325 w0_t[1] = salt_buf0[1];
326 w0_t[2] = salt_buf0[2];
327 w0_t[3] = salt_buf0[3];
328 w1_t[0] = salt_buf1[0];
329 w1_t[1] = salt_buf1[1];
330 w1_t[2] = salt_buf1[2];
331 w1_t[3] = salt_buf1[3];
332 w2_t[0] = salt_buf2[0];
333 w2_t[1] = salt_buf2[1];
334 w2_t[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
335 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
336 w2_t[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
337 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
338 w3_t[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
339 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
340 w3_t[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
341 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
342 w3_t[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
343 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
344 w3_t[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
345 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
353 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
355 w0_t[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
356 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
357 w0_t[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
358 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
359 w0_t[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
360 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
361 w0_t[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
362 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
363 w1_t[0] = 0x80000000;
376 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
378 COMPARE_M_SIMD (digest[3], digest[4], digest[2], digest[1]);
382 static 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)
388 const u32 gid = get_global_id (0);
389 const u32 lid = get_local_id (0);
395 const u32 search[4] =
397 digests_buf[digests_offset].digest_buf[DGST_R0],
398 digests_buf[digests_offset].digest_buf[DGST_R1],
399 digests_buf[digests_offset].digest_buf[DGST_R2],
400 digests_buf[digests_offset].digest_buf[DGST_R3]
409 salt_buf0[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 0]);
410 salt_buf0[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 1]);
411 salt_buf0[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 2]);
412 salt_buf0[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 3]);
416 salt_buf1[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 4]);
417 salt_buf1[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 5]);
418 salt_buf1[2] = swap32_S (salt_bufs[salt_pos].salt_buf[ 6]);
419 salt_buf1[3] = swap32_S (salt_bufs[salt_pos].salt_buf[ 7]);
423 salt_buf2[0] = swap32_S (salt_bufs[salt_pos].salt_buf[ 8]);
424 salt_buf2[1] = swap32_S (salt_bufs[salt_pos].salt_buf[ 9]);
428 const u32 salt_len = salt_bufs[salt_pos].salt_len;
436 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
438 const u32x w0r = ix_create_bft (bfs_buf, il_pos);
440 const u32x w0lr = w0l | w0r;
468 w3_t[3] = pw_len * 8;
478 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
492 w0_t[0] = salt_buf0[0];
493 w0_t[1] = salt_buf0[1];
494 w0_t[2] = salt_buf0[2];
495 w0_t[3] = salt_buf0[3];
496 w1_t[0] = salt_buf1[0];
497 w1_t[1] = salt_buf1[1];
498 w1_t[2] = salt_buf1[2];
499 w1_t[3] = salt_buf1[3];
500 w2_t[0] = salt_buf2[0];
501 w2_t[1] = salt_buf2[1];
502 w2_t[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
503 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
504 w2_t[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
505 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
506 w3_t[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
507 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
508 w3_t[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
509 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
510 w3_t[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
511 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
512 w3_t[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
513 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
521 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
523 w0_t[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
524 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
525 w0_t[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
526 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
527 w0_t[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
528 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
529 w0_t[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
530 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
531 w1_t[0] = 0x80000000;
542 w3_t[3] = (salt_len + 40) * 8;
544 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
552 w0_t[0] = salt_buf0[0];
553 w0_t[1] = salt_buf0[1];
554 w0_t[2] = salt_buf0[2];
555 w0_t[3] = salt_buf0[3];
556 w1_t[0] = salt_buf1[0];
557 w1_t[1] = salt_buf1[1];
558 w1_t[2] = salt_buf1[2];
559 w1_t[3] = salt_buf1[3];
560 w2_t[0] = salt_buf2[0];
561 w2_t[1] = salt_buf2[1];
562 w2_t[2] = uint_to_hex_lower8_le ((a >> 16) & 255) << 0
563 | uint_to_hex_lower8_le ((a >> 24) & 255) << 16;
564 w2_t[3] = uint_to_hex_lower8_le ((a >> 0) & 255) << 0
565 | uint_to_hex_lower8_le ((a >> 8) & 255) << 16;
566 w3_t[0] = uint_to_hex_lower8_le ((b >> 16) & 255) << 0
567 | uint_to_hex_lower8_le ((b >> 24) & 255) << 16;
568 w3_t[1] = uint_to_hex_lower8_le ((b >> 0) & 255) << 0
569 | uint_to_hex_lower8_le ((b >> 8) & 255) << 16;
570 w3_t[2] = uint_to_hex_lower8_le ((c >> 16) & 255) << 0
571 | uint_to_hex_lower8_le ((c >> 24) & 255) << 16;
572 w3_t[3] = uint_to_hex_lower8_le ((c >> 0) & 255) << 0
573 | uint_to_hex_lower8_le ((c >> 8) & 255) << 16;
581 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
583 w0_t[0] = uint_to_hex_lower8_le ((d >> 16) & 255) << 0
584 | uint_to_hex_lower8_le ((d >> 24) & 255) << 16;
585 w0_t[1] = uint_to_hex_lower8_le ((d >> 0) & 255) << 0
586 | uint_to_hex_lower8_le ((d >> 8) & 255) << 16;
587 w0_t[2] = uint_to_hex_lower8_le ((e >> 16) & 255) << 0
588 | uint_to_hex_lower8_le ((e >> 24) & 255) << 16;
589 w0_t[3] = uint_to_hex_lower8_le ((e >> 0) & 255) << 0
590 | uint_to_hex_lower8_le ((e >> 8) & 255) << 16;
591 w1_t[0] = 0x80000000;
602 w3_t[3] = (salt_len + 40) * 8;
604 sha1_transform (w0_t, w1_t, w2_t, w3_t, digest);
606 COMPARE_S_SIMD (digest[3], digest[4], digest[2], digest[1]);
610 __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)
616 const u32 gid = get_global_id (0);
617 const u32 lid = get_local_id (0);
618 const u32 lsz = get_local_size (0);
624 __local u32 l_bin2asc[256];
626 for (u32 i = lid; i < 256; i += lsz)
628 const u32 i0 = (i >> 0) & 15;
629 const u32 i1 = (i >> 4) & 15;
631 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
632 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
635 barrier (CLK_LOCAL_MEM_FENCE);
637 if (gid >= gid_max) return;
645 w0[0] = pws[gid].i[ 0];
646 w0[1] = pws[gid].i[ 1];
647 w0[2] = pws[gid].i[ 2];
648 w0[3] = pws[gid].i[ 3];
671 const u32 pw_len = pws[gid].pw_len;
677 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);
680 __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)
686 const u32 gid = get_global_id (0);
687 const u32 lid = get_local_id (0);
688 const u32 lsz = get_local_size (0);
694 __local u32 l_bin2asc[256];
696 for (u32 i = lid; i < 256; i += lsz)
698 const u32 i0 = (i >> 0) & 15;
699 const u32 i1 = (i >> 4) & 15;
701 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
702 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
705 barrier (CLK_LOCAL_MEM_FENCE);
707 if (gid >= gid_max) return;
715 w0[0] = pws[gid].i[ 0];
716 w0[1] = pws[gid].i[ 1];
717 w0[2] = pws[gid].i[ 2];
718 w0[3] = pws[gid].i[ 3];
722 w1[0] = pws[gid].i[ 4];
723 w1[1] = pws[gid].i[ 5];
724 w1[2] = pws[gid].i[ 6];
725 w1[3] = pws[gid].i[ 7];
741 const u32 pw_len = pws[gid].pw_len;
747 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);
750 __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)
756 const u32 gid = get_global_id (0);
757 const u32 lid = get_local_id (0);
758 const u32 lsz = get_local_size (0);
764 __local u32 l_bin2asc[256];
766 for (u32 i = lid; i < 256; i += lsz)
768 const u32 i0 = (i >> 0) & 15;
769 const u32 i1 = (i >> 4) & 15;
771 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
772 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
775 barrier (CLK_LOCAL_MEM_FENCE);
777 if (gid >= gid_max) return;
785 w0[0] = pws[gid].i[ 0];
786 w0[1] = pws[gid].i[ 1];
787 w0[2] = pws[gid].i[ 2];
788 w0[3] = pws[gid].i[ 3];
792 w1[0] = pws[gid].i[ 4];
793 w1[1] = pws[gid].i[ 5];
794 w1[2] = pws[gid].i[ 6];
795 w1[3] = pws[gid].i[ 7];
799 w2[0] = pws[gid].i[ 8];
800 w2[1] = pws[gid].i[ 9];
801 w2[2] = pws[gid].i[10];
802 w2[3] = pws[gid].i[11];
806 w3[0] = pws[gid].i[12];
807 w3[1] = pws[gid].i[13];
811 const u32 pw_len = pws[gid].pw_len;
817 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);
820 __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)
826 const u32 gid = get_global_id (0);
827 const u32 lid = get_local_id (0);
828 const u32 lsz = get_local_size (0);
834 __local u32 l_bin2asc[256];
836 for (u32 i = lid; i < 256; i += lsz)
838 const u32 i0 = (i >> 0) & 15;
839 const u32 i1 = (i >> 4) & 15;
841 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
842 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
845 barrier (CLK_LOCAL_MEM_FENCE);
847 if (gid >= gid_max) return;
855 w0[0] = pws[gid].i[ 0];
856 w0[1] = pws[gid].i[ 1];
857 w0[2] = pws[gid].i[ 2];
858 w0[3] = pws[gid].i[ 3];
881 const u32 pw_len = pws[gid].pw_len;
887 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);
890 __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)
896 const u32 gid = get_global_id (0);
897 const u32 lid = get_local_id (0);
898 const u32 lsz = get_local_size (0);
904 __local u32 l_bin2asc[256];
906 for (u32 i = lid; i < 256; i += lsz)
908 const u32 i0 = (i >> 0) & 15;
909 const u32 i1 = (i >> 4) & 15;
911 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
912 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
915 barrier (CLK_LOCAL_MEM_FENCE);
917 if (gid >= gid_max) return;
925 w0[0] = pws[gid].i[ 0];
926 w0[1] = pws[gid].i[ 1];
927 w0[2] = pws[gid].i[ 2];
928 w0[3] = pws[gid].i[ 3];
932 w1[0] = pws[gid].i[ 4];
933 w1[1] = pws[gid].i[ 5];
934 w1[2] = pws[gid].i[ 6];
935 w1[3] = pws[gid].i[ 7];
951 const u32 pw_len = pws[gid].pw_len;
957 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);
960 __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)
966 const u32 gid = get_global_id (0);
967 const u32 lid = get_local_id (0);
968 const u32 lsz = get_local_size (0);
974 __local u32 l_bin2asc[256];
976 for (u32 i = lid; i < 256; i += lsz)
978 const u32 i0 = (i >> 0) & 15;
979 const u32 i1 = (i >> 4) & 15;
981 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
982 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
985 barrier (CLK_LOCAL_MEM_FENCE);
987 if (gid >= gid_max) return;
995 w0[0] = pws[gid].i[ 0];
996 w0[1] = pws[gid].i[ 1];
997 w0[2] = pws[gid].i[ 2];
998 w0[3] = pws[gid].i[ 3];
1002 w1[0] = pws[gid].i[ 4];
1003 w1[1] = pws[gid].i[ 5];
1004 w1[2] = pws[gid].i[ 6];
1005 w1[3] = pws[gid].i[ 7];
1009 w2[0] = pws[gid].i[ 8];
1010 w2[1] = pws[gid].i[ 9];
1011 w2[2] = pws[gid].i[10];
1012 w2[3] = pws[gid].i[11];
1016 w3[0] = pws[gid].i[12];
1017 w3[1] = pws[gid].i[13];
1021 const u32 pw_len = pws[gid].pw_len;
1027 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);