/**
- * Author......: Jens Steube <jens.steube@gmail.com>
+ * Authors.....: Jens Steube <jens.steube@gmail.com>
+ * Gabriele Gristina <matrix@hashcat.net>
+ * magnum <john.magnum@hushmail.com>
+ *
* License.....: MIT
*/
#define _MD4_
-#include "include/constants.h"
-#include "include/kernel_vendor.h"
+#define NEW_SIMD_CODE
-#define DGST_R0 0
-#define DGST_R1 1
-#define DGST_R2 2
-#define DGST_R3 3
-
-#include "include/kernel_functions.c"
-#include "types_ocl.c"
-#include "common.c"
-
-#define COMPARE_S "check_single_comp4.c"
-#define COMPARE_M "check_multi_comp4.c"
+#include "inc_vendor.cl"
+#include "inc_hash_constants.h"
+#include "inc_hash_functions.cl"
+#include "inc_types.cl"
+#include "inc_common.cl"
+#include "inc_simd.cl"
#define PERM_OP(a,b,tt,n,m) \
{ \
}
};
+#if VECT_SIZE == 1
#define BOX(i,n,S) (S)[(n)][(i)]
-
-static void _des_crypt_encrypt (u32 iv[2], u32 data[2], u32 Kc[16], u32 Kd[16], __local u32 s_SPtrans[8][64])
+#elif VECT_SIZE == 2
+#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1])
+#elif VECT_SIZE == 4
+#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3])
+#elif VECT_SIZE == 8
+#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7])
+#elif VECT_SIZE == 16
+#define BOX(i,n,S) (u32x) ((S)[(n)][(i).s0], (S)[(n)][(i).s1], (S)[(n)][(i).s2], (S)[(n)][(i).s3], (S)[(n)][(i).s4], (S)[(n)][(i).s5], (S)[(n)][(i).s6], (S)[(n)][(i).s7], (S)[(n)][(i).s8], (S)[(n)][(i).s9], (S)[(n)][(i).sa], (S)[(n)][(i).sb], (S)[(n)][(i).sc], (S)[(n)][(i).sd], (S)[(n)][(i).se], (S)[(n)][(i).sf])
+#endif
+
+void _des_crypt_encrypt (u32x iv[2], u32x data[2], u32x Kc[16], u32x Kd[16], __local u32 (*s_SPtrans)[64])
{
- u32 r = data[0];
- u32 l = data[1];
+ u32x r = data[0];
+ u32x l = data[1];
- #pragma unroll 16
+ #ifdef _unroll
+ #pragma unroll
+ #endif
for (u32 i = 0; i < 16; i += 2)
{
- u32 u;
- u32 t;
+ u32x u;
+ u32x t;
u = Kc[i + 0] ^ rotl32 (r, 30u);
t = Kd[i + 0] ^ rotl32 (r, 26u);
iv[1] = r;
}
-static void _des_crypt_keysetup (u32 c, u32 d, u32 Kc[16], u32 Kd[16], __local u32 s_skb[8][64])
+void _des_crypt_keysetup (u32x c, u32x d, u32x Kc[16], u32x Kd[16], __local u32 (*s_skb)[64])
{
- u32 tt;
+ u32x tt;
PERM_OP (d, c, tt, 4, 0x0f0f0f0f);
HPERM_OP (c, tt, 2, 0xcccc0000);
c = c & 0x0fffffff;
- #pragma unroll 16
+ #ifdef _unroll
+ #pragma unroll
+ #endif
for (u32 i = 0; i < 16; i++)
{
if ((i < 2) || (i == 8) || (i == 15))
c = c & 0x0fffffff;
d = d & 0x0fffffff;
- const u32 c00 = (c >> 0) & 0x0000003f;
- const u32 c06 = (c >> 6) & 0x00383003;
- const u32 c07 = (c >> 7) & 0x0000003c;
- const u32 c13 = (c >> 13) & 0x0000060f;
- const u32 c20 = (c >> 20) & 0x00000001;
-
- u32 s = BOX (((c00 >> 0) & 0xff), 0, s_skb)
- | BOX (((c06 >> 0) & 0xff)
- |((c07 >> 0) & 0xff), 1, s_skb)
- | BOX (((c13 >> 0) & 0xff)
- |((c06 >> 8) & 0xff), 2, s_skb)
- | BOX (((c20 >> 0) & 0xff)
- |((c13 >> 8) & 0xff)
- |((c06 >> 16) & 0xff), 3, s_skb);
-
- const u32 d00 = (d >> 0) & 0x00003c3f;
- const u32 d07 = (d >> 7) & 0x00003f03;
- const u32 d21 = (d >> 21) & 0x0000000f;
- const u32 d22 = (d >> 22) & 0x00000030;
-
- u32 t = BOX (((d00 >> 0) & 0xff), 4, s_skb)
- | BOX (((d07 >> 0) & 0xff)
- |((d00 >> 8) & 0xff), 5, s_skb)
- | BOX (((d07 >> 8) & 0xff), 6, s_skb)
- | BOX (((d21 >> 0) & 0xff)
- |((d22 >> 0) & 0xff), 7, s_skb);
+ const u32x c00 = (c >> 0) & 0x0000003f;
+ const u32x c06 = (c >> 6) & 0x00383003;
+ const u32x c07 = (c >> 7) & 0x0000003c;
+ const u32x c13 = (c >> 13) & 0x0000060f;
+ const u32x c20 = (c >> 20) & 0x00000001;
+
+ u32x s = BOX (((c00 >> 0) & 0xff), 0, s_skb)
+ | BOX (((c06 >> 0) & 0xff)
+ |((c07 >> 0) & 0xff), 1, s_skb)
+ | BOX (((c13 >> 0) & 0xff)
+ |((c06 >> 8) & 0xff), 2, s_skb)
+ | BOX (((c20 >> 0) & 0xff)
+ |((c13 >> 8) & 0xff)
+ |((c06 >> 16) & 0xff), 3, s_skb);
+
+ const u32x d00 = (d >> 0) & 0x00003c3f;
+ const u32x d07 = (d >> 7) & 0x00003f03;
+ const u32x d21 = (d >> 21) & 0x0000000f;
+ const u32x d22 = (d >> 22) & 0x00000030;
+
+ u32x t = BOX (((d00 >> 0) & 0xff), 4, s_skb)
+ | BOX (((d07 >> 0) & 0xff)
+ |((d00 >> 8) & 0xff), 5, s_skb)
+ | BOX (((d07 >> 8) & 0xff), 6, s_skb)
+ | BOX (((d21 >> 0) & 0xff)
+ |((d22 >> 0) & 0xff), 7, s_skb);
Kc[i] = ((t << 16) | (s & 0x0000ffff));
Kd[i] = ((s >> 16) | (t & 0xffff0000));
}
}
-static void transform_netntlmv1_key (const u32 w0, const u32 w1, u32 out[2])
+void transform_netntlmv1_key (const u32x w0, const u32x w1, u32x out[2])
{
- const uchar4 t0 = as_uchar4 (w0);
- const uchar4 t1 = as_uchar4 (w1);
-
- uchar4 k0;
- uchar4 k1;
-
- k0.s0 = (t0.s0 >> 0);
- k0.s1 = (t0.s0 << 7) | (t0.s1 >> 1);
- k0.s2 = (t0.s1 << 6) | (t0.s2 >> 2);
- k0.s3 = (t0.s2 << 5) | (t0.s3 >> 3);
- k1.s0 = (t0.s3 << 4) | (t1.s0 >> 4);
- k1.s1 = (t1.s0 << 3) | (t1.s1 >> 5);
- k1.s2 = (t1.s1 << 2) | (t1.s2 >> 6);
- k1.s3 = (t1.s2 << 1);
-
- out[0] = as_uint (k0);
- out[1] = as_uint (k1);
+ u32x t[8];
+
+ t[0] = (w0 >> 0) & 0xff;
+ t[1] = (w0 >> 8) & 0xff;
+ t[2] = (w0 >> 16) & 0xff;
+ t[3] = (w0 >> 24) & 0xff;
+ t[4] = (w1 >> 0) & 0xff;
+ t[5] = (w1 >> 8) & 0xff;
+ t[6] = (w1 >> 16) & 0xff;
+ t[7] = (w1 >> 24) & 0xff;
+
+ u32x k[8];
+
+ k[0] = (t[0] >> 0);
+ k[1] = (t[0] << 7) | (t[1] >> 1);
+ k[2] = (t[1] << 6) | (t[2] >> 2);
+ k[3] = (t[2] << 5) | (t[3] >> 3);
+ k[4] = (t[3] << 4) | (t[4] >> 4);
+ k[5] = (t[4] << 3) | (t[5] >> 5);
+ k[6] = (t[5] << 2) | (t[6] >> 6);
+ k[7] = (t[6] << 1);
+
+ out[0] = ((k[0] & 0xff) << 0)
+ | ((k[1] & 0xff) << 8)
+ | ((k[2] & 0xff) << 16)
+ | ((k[3] & 0xff) << 24);
+
+ out[1] = ((k[4] & 0xff) << 0)
+ | ((k[5] & 0xff) << 8)
+ | ((k[6] & 0xff) << 16)
+ | ((k[7] & 0xff) << 24);
}
-static void m05500m (__local u32 s_SPtrans[8][64], __local u32 s_skb[8][64], u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __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)
+void m05500m (__local u32 (*s_SPtrans)[64], __local u32 (*s_skb)[64], u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
{
/**
* modifier
const u32 s1 = salt_bufs[salt_pos].salt_buf[1];
const u32 s2 = salt_bufs[salt_pos].salt_buf[2];
- u32 data[2];
-
- data[0] = s0;
- data[1] = s1;
-
/**
* loop
*/
u32 w0l = w[0];
- for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
+ for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
- const u32 w0r = words_buf_r[il_pos];
-
- const u32 w0 = w0l | w0r;
-
- u32 a = MD4M_A;
- u32 b = MD4M_B;
- u32 c = MD4M_C;
- u32 d = MD4M_D;
-
- #define w0_t w0
- #define w1_t w[ 1]
- #define w2_t w[ 2]
- #define w3_t w[ 3]
- #define w4_t w[ 4]
- #define w5_t w[ 5]
- #define w6_t w[ 6]
- #define w7_t w[ 7]
- #define w8_t w[ 8]
- #define w9_t w[ 9]
- #define wa_t w[10]
- #define wb_t w[11]
- #define wc_t w[12]
- #define wd_t w[13]
- #define we_t w[14]
- #define wf_t w[15]
-
- MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
- MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
- MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
- MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
- MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
- MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
- MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
- MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
- MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
- MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
- MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
- MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
- MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
- MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
- MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
- MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
-
- MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
- MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
- MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
- MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
- MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
- MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
- MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
- MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
- MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
- MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
- MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
- MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
- MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
- MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
- MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
- MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
-
- MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
- MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
- MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
- MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
- MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
- MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
- MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
- MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
- MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
- MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
- MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
- MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
- MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
- MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
-
- if (allx (s2 != ((d + MD4M_D) >> 16))) continue;
-
- MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
- MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
+ const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
+
+ const u32x w0 = w0l | w0r;
+
+ u32x w0_t[4];
+ u32x w1_t[4];
+ u32x w2_t[4];
+ u32x w3_t[4];
+
+ w0_t[0] = w0;
+ w0_t[1] = w[ 1];
+ w0_t[2] = w[ 2];
+ w0_t[3] = w[ 3];
+ w1_t[0] = w[ 4];
+ w1_t[1] = w[ 5];
+ w1_t[2] = w[ 6];
+ w1_t[3] = w[ 7];
+ w2_t[0] = w[ 8];
+ w2_t[1] = w[ 9];
+ w2_t[2] = w[10];
+ w2_t[3] = w[11];
+ w3_t[0] = w[12];
+ w3_t[1] = w[13];
+ w3_t[2] = w[14];
+ w3_t[3] = w[15];
+
+ u32x a = MD4M_A;
+ u32x b = MD4M_B;
+ u32x c = MD4M_C;
+ u32x d = MD4M_D;
+
+ MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
+ MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
+ MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
+ MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
+ MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
+ MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
+ MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
+ MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
+ MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
+ MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
+ MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
+ MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
+ MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
+ MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
+ MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
+ MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
+
+ MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
+ MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
+ MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
+ MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
+ MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
+ MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
+ MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
+ MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
+ MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
+ MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
+ MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
+ MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
+ MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
+ MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
+ MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
+ MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
+
+ MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
+ MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
+ MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
+ MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
+ MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
+ MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
+ MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
+ MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
+ MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
+ MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
+ MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
+ MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
+ MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
+ MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
+
+ if (MATCHES_NONE_VS (((d + MD4M_D) >> 16), s2)) continue;
+
+ MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
+ MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
a += MD4M_A;
b += MD4M_B;
* DES1
*/
- u32 key[2];
+ u32x key[2];
transform_netntlmv1_key (a, b, key);
- u32 Kc[16];
- u32 Kd[16];
+ u32x Kc[16];
+ u32x Kd[16];
_des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb);
- u32 iv1[2];
+ u32x data[2];
+
+ data[0] = s0;
+ data[1] = s1;
+
+ u32x iv1[2];
_des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans);
_des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb);
- u32 iv2[2];
+ u32x iv2[2];
_des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans);
* compare
*/
- const u32 r0 = iv1[0];
- const u32 r1 = iv1[1];
- const u32 r2 = iv2[0];
- const u32 r3 = iv2[1];
-
- #include COMPARE_M
+ COMPARE_M_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]);
}
}
-static void m05500s (__local u32 s_SPtrans[8][64], __local u32 s_skb[8][64], u32 w[16], const u32 pw_len, __global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __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)
+void m05500s (__local u32 (*s_SPtrans)[64], __local u32 (*s_skb)[64], u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
{
/**
* modifier
const u32 s1 = salt_bufs[salt_pos].salt_buf[1];
const u32 s2 = salt_bufs[salt_pos].salt_buf[2];
- u32 data[2];
-
- data[0] = s0;
- data[1] = s1;
-
/**
* digest
*/
u32 w0l = w[0];
- for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
+ for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
{
- const u32 w0r = words_buf_r[il_pos];
-
- const u32 w0 = w0l | w0r;
-
- u32 a = MD4M_A;
- u32 b = MD4M_B;
- u32 c = MD4M_C;
- u32 d = MD4M_D;
-
- #define w0_t w0
- #define w1_t w[ 1]
- #define w2_t w[ 2]
- #define w3_t w[ 3]
- #define w4_t w[ 4]
- #define w5_t w[ 5]
- #define w6_t w[ 6]
- #define w7_t w[ 7]
- #define w8_t w[ 8]
- #define w9_t w[ 9]
- #define wa_t w[10]
- #define wb_t w[11]
- #define wc_t w[12]
- #define wd_t w[13]
- #define we_t w[14]
- #define wf_t w[15]
-
- MD4_STEP (MD4_Fo, a, b, c, d, w0_t, MD4C00, MD4S00);
- MD4_STEP (MD4_Fo, d, a, b, c, w1_t, MD4C00, MD4S01);
- MD4_STEP (MD4_Fo, c, d, a, b, w2_t, MD4C00, MD4S02);
- MD4_STEP (MD4_Fo, b, c, d, a, w3_t, MD4C00, MD4S03);
- MD4_STEP (MD4_Fo, a, b, c, d, w4_t, MD4C00, MD4S00);
- MD4_STEP (MD4_Fo, d, a, b, c, w5_t, MD4C00, MD4S01);
- MD4_STEP (MD4_Fo, c, d, a, b, w6_t, MD4C00, MD4S02);
- MD4_STEP (MD4_Fo, b, c, d, a, w7_t, MD4C00, MD4S03);
- MD4_STEP (MD4_Fo, a, b, c, d, w8_t, MD4C00, MD4S00);
- MD4_STEP (MD4_Fo, d, a, b, c, w9_t, MD4C00, MD4S01);
- MD4_STEP (MD4_Fo, c, d, a, b, wa_t, MD4C00, MD4S02);
- MD4_STEP (MD4_Fo, b, c, d, a, wb_t, MD4C00, MD4S03);
- MD4_STEP (MD4_Fo, a, b, c, d, wc_t, MD4C00, MD4S00);
- MD4_STEP (MD4_Fo, d, a, b, c, wd_t, MD4C00, MD4S01);
- MD4_STEP (MD4_Fo, c, d, a, b, we_t, MD4C00, MD4S02);
- MD4_STEP (MD4_Fo, b, c, d, a, wf_t, MD4C00, MD4S03);
-
- MD4_STEP (MD4_Go, a, b, c, d, w0_t, MD4C01, MD4S10);
- MD4_STEP (MD4_Go, d, a, b, c, w4_t, MD4C01, MD4S11);
- MD4_STEP (MD4_Go, c, d, a, b, w8_t, MD4C01, MD4S12);
- MD4_STEP (MD4_Go, b, c, d, a, wc_t, MD4C01, MD4S13);
- MD4_STEP (MD4_Go, a, b, c, d, w1_t, MD4C01, MD4S10);
- MD4_STEP (MD4_Go, d, a, b, c, w5_t, MD4C01, MD4S11);
- MD4_STEP (MD4_Go, c, d, a, b, w9_t, MD4C01, MD4S12);
- MD4_STEP (MD4_Go, b, c, d, a, wd_t, MD4C01, MD4S13);
- MD4_STEP (MD4_Go, a, b, c, d, w2_t, MD4C01, MD4S10);
- MD4_STEP (MD4_Go, d, a, b, c, w6_t, MD4C01, MD4S11);
- MD4_STEP (MD4_Go, c, d, a, b, wa_t, MD4C01, MD4S12);
- MD4_STEP (MD4_Go, b, c, d, a, we_t, MD4C01, MD4S13);
- MD4_STEP (MD4_Go, a, b, c, d, w3_t, MD4C01, MD4S10);
- MD4_STEP (MD4_Go, d, a, b, c, w7_t, MD4C01, MD4S11);
- MD4_STEP (MD4_Go, c, d, a, b, wb_t, MD4C01, MD4S12);
- MD4_STEP (MD4_Go, b, c, d, a, wf_t, MD4C01, MD4S13);
-
- MD4_STEP (MD4_H , a, b, c, d, w0_t, MD4C02, MD4S20);
- MD4_STEP (MD4_H , d, a, b, c, w8_t, MD4C02, MD4S21);
- MD4_STEP (MD4_H , c, d, a, b, w4_t, MD4C02, MD4S22);
- MD4_STEP (MD4_H , b, c, d, a, wc_t, MD4C02, MD4S23);
- MD4_STEP (MD4_H , a, b, c, d, w2_t, MD4C02, MD4S20);
- MD4_STEP (MD4_H , d, a, b, c, wa_t, MD4C02, MD4S21);
- MD4_STEP (MD4_H , c, d, a, b, w6_t, MD4C02, MD4S22);
- MD4_STEP (MD4_H , b, c, d, a, we_t, MD4C02, MD4S23);
- MD4_STEP (MD4_H , a, b, c, d, w1_t, MD4C02, MD4S20);
- MD4_STEP (MD4_H , d, a, b, c, w9_t, MD4C02, MD4S21);
- MD4_STEP (MD4_H , c, d, a, b, w5_t, MD4C02, MD4S22);
- MD4_STEP (MD4_H , b, c, d, a, wd_t, MD4C02, MD4S23);
- MD4_STEP (MD4_H , a, b, c, d, w3_t, MD4C02, MD4S20);
- MD4_STEP (MD4_H , d, a, b, c, wb_t, MD4C02, MD4S21);
-
- if (allx (s2 != ((d + MD4M_D) >> 16))) continue;
-
- MD4_STEP (MD4_H , c, d, a, b, w7_t, MD4C02, MD4S22);
- MD4_STEP (MD4_H , b, c, d, a, wf_t, MD4C02, MD4S23);
+ const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
+
+ const u32x w0 = w0l | w0r;
+
+ u32x w0_t[4];
+ u32x w1_t[4];
+ u32x w2_t[4];
+ u32x w3_t[4];
+
+ w0_t[0] = w0;
+ w0_t[1] = w[ 1];
+ w0_t[2] = w[ 2];
+ w0_t[3] = w[ 3];
+ w1_t[0] = w[ 4];
+ w1_t[1] = w[ 5];
+ w1_t[2] = w[ 6];
+ w1_t[3] = w[ 7];
+ w2_t[0] = w[ 8];
+ w2_t[1] = w[ 9];
+ w2_t[2] = w[10];
+ w2_t[3] = w[11];
+ w3_t[0] = w[12];
+ w3_t[1] = w[13];
+ w3_t[2] = w[14];
+ w3_t[3] = w[15];
+
+ u32x a = MD4M_A;
+ u32x b = MD4M_B;
+ u32x c = MD4M_C;
+ u32x d = MD4M_D;
+
+ MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
+ MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
+ MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
+ MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
+ MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
+ MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
+ MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
+ MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
+ MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
+ MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
+ MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
+ MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
+ MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
+ MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
+ MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
+ MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
+
+ MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
+ MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
+ MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
+ MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
+ MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
+ MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
+ MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
+ MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
+ MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
+ MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
+ MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
+ MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
+ MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
+ MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
+ MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
+ MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
+
+ MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
+ MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
+ MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
+ MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
+ MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
+ MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
+ MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
+ MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
+ MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
+ MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
+ MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
+ MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
+ MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
+ MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
+
+ if (MATCHES_NONE_VS (((d + MD4M_D) >> 16), s2)) continue;
+
+ MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
+ MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
a += MD4M_A;
b += MD4M_B;
* DES1
*/
- u32 key[2];
+ u32x key[2];
transform_netntlmv1_key (a, b, key);
- u32 Kc[16];
- u32 Kd[16];
+ u32x Kc[16];
+ u32x Kd[16];
_des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb);
- u32 iv1[2];
+ u32x data[2];
+
+ data[0] = s0;
+ data[1] = s1;
+
+ u32x iv1[2];
_des_crypt_encrypt (iv1, data, Kc, Kd, s_SPtrans);
_des_crypt_keysetup (key[0], key[1], Kc, Kd, s_skb);
- u32 iv2[2];
+ u32x iv2[2];
_des_crypt_encrypt (iv2, data, Kc, Kd, s_SPtrans);
*/
- u32 iv2[2];
+ u32x iv2[2];
iv2[0] = search[2];
iv2[1] = search[3];
* compare
*/
- const u32 r0 = iv1[0];
- const u32 r1 = iv1[1];
- const u32 r2 = iv2[0];
- const u32 r3 = iv2[1];
-
- #include COMPARE_S
+ COMPARE_S_SIMD (iv1[0], iv1[1], iv2[0], iv2[1]);
}
}
-__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05500_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __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)
+__kernel void m05500_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
{
/**
- * base
+ * modifier
*/
const u32 gid = get_global_id (0);
const u32 lid = get_local_id (0);
+ const u32 lsz = get_local_size (0);
+
+ /**
+ * sbox, kbox
+ */
+
+ __local u32 s_SPtrans[8][64];
+ __local u32 s_skb[8][64];
+
+ for (u32 i = lid; i < 64; i += lsz)
+ {
+ s_SPtrans[0][i] = c_SPtrans[0][i];
+ s_SPtrans[1][i] = c_SPtrans[1][i];
+ s_SPtrans[2][i] = c_SPtrans[2][i];
+ s_SPtrans[3][i] = c_SPtrans[3][i];
+ s_SPtrans[4][i] = c_SPtrans[4][i];
+ s_SPtrans[5][i] = c_SPtrans[5][i];
+ s_SPtrans[6][i] = c_SPtrans[6][i];
+ s_SPtrans[7][i] = c_SPtrans[7][i];
+
+ s_skb[0][i] = c_skb[0][i];
+ s_skb[1][i] = c_skb[1][i];
+ s_skb[2][i] = c_skb[2][i];
+ s_skb[3][i] = c_skb[3][i];
+ s_skb[4][i] = c_skb[4][i];
+ s_skb[5][i] = c_skb[5][i];
+ s_skb[6][i] = c_skb[6][i];
+ s_skb[7][i] = c_skb[7][i];
+ }
+
+ barrier (CLK_LOCAL_MEM_FENCE);
+
+ if (gid >= gid_max) return;
+
+ /**
+ * base
+ */
u32 w[16];
const u32 pw_len = pws[gid].pw_len;
+ /**
+ * main
+ */
+
+ m05500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
+}
+
+__kernel void m05500_m08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
+{
+ /**
+ * modifier
+ */
+
+ const u32 gid = get_global_id (0);
+ const u32 lid = get_local_id (0);
+ const u32 lsz = get_local_size (0);
+
/**
* sbox, kbox
*/
__local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64];
- s_SPtrans[0][lid] = c_SPtrans[0][lid];
- s_SPtrans[1][lid] = c_SPtrans[1][lid];
- s_SPtrans[2][lid] = c_SPtrans[2][lid];
- s_SPtrans[3][lid] = c_SPtrans[3][lid];
- s_SPtrans[4][lid] = c_SPtrans[4][lid];
- s_SPtrans[5][lid] = c_SPtrans[5][lid];
- s_SPtrans[6][lid] = c_SPtrans[6][lid];
- s_SPtrans[7][lid] = c_SPtrans[7][lid];
-
- s_skb[0][lid] = c_skb[0][lid];
- s_skb[1][lid] = c_skb[1][lid];
- s_skb[2][lid] = c_skb[2][lid];
- s_skb[3][lid] = c_skb[3][lid];
- s_skb[4][lid] = c_skb[4][lid];
- s_skb[5][lid] = c_skb[5][lid];
- s_skb[6][lid] = c_skb[6][lid];
- s_skb[7][lid] = c_skb[7][lid];
+ for (u32 i = lid; i < 64; i += lsz)
+ {
+ s_SPtrans[0][i] = c_SPtrans[0][i];
+ s_SPtrans[1][i] = c_SPtrans[1][i];
+ s_SPtrans[2][i] = c_SPtrans[2][i];
+ s_SPtrans[3][i] = c_SPtrans[3][i];
+ s_SPtrans[4][i] = c_SPtrans[4][i];
+ s_SPtrans[5][i] = c_SPtrans[5][i];
+ s_SPtrans[6][i] = c_SPtrans[6][i];
+ s_SPtrans[7][i] = c_SPtrans[7][i];
+
+ s_skb[0][i] = c_skb[0][i];
+ s_skb[1][i] = c_skb[1][i];
+ s_skb[2][i] = c_skb[2][i];
+ s_skb[3][i] = c_skb[3][i];
+ s_skb[4][i] = c_skb[4][i];
+ s_skb[5][i] = c_skb[5][i];
+ s_skb[6][i] = c_skb[6][i];
+ s_skb[7][i] = c_skb[7][i];
+ }
barrier (CLK_LOCAL_MEM_FENCE);
if (gid >= gid_max) return;
- /**
- * main
- */
-
- m05500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
-}
-
-__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05500_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __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)
-{
/**
* base
*/
- const u32 gid = get_global_id (0);
- const u32 lid = get_local_id (0);
-
u32 w[16];
w[ 0] = pws[gid].i[ 0];
const u32 pw_len = pws[gid].pw_len;
- /**
- * sbox, kbox
- */
-
- __local u32 s_SPtrans[8][64];
- __local u32 s_skb[8][64];
-
- s_SPtrans[0][lid] = c_SPtrans[0][lid];
- s_SPtrans[1][lid] = c_SPtrans[1][lid];
- s_SPtrans[2][lid] = c_SPtrans[2][lid];
- s_SPtrans[3][lid] = c_SPtrans[3][lid];
- s_SPtrans[4][lid] = c_SPtrans[4][lid];
- s_SPtrans[5][lid] = c_SPtrans[5][lid];
- s_SPtrans[6][lid] = c_SPtrans[6][lid];
- s_SPtrans[7][lid] = c_SPtrans[7][lid];
-
- s_skb[0][lid] = c_skb[0][lid];
- s_skb[1][lid] = c_skb[1][lid];
- s_skb[2][lid] = c_skb[2][lid];
- s_skb[3][lid] = c_skb[3][lid];
- s_skb[4][lid] = c_skb[4][lid];
- s_skb[5][lid] = c_skb[5][lid];
- s_skb[6][lid] = c_skb[6][lid];
- s_skb[7][lid] = c_skb[7][lid];
-
- barrier (CLK_LOCAL_MEM_FENCE);
-
- if (gid >= gid_max) return;
-
/**
* main
*/
- m05500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
+ m05500m (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
}
-__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05500_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __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)
+__kernel void m05500_m16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
{
}
-__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05500_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __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)
+__kernel void m05500_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
{
/**
- * base
+ * modifier
*/
const u32 gid = get_global_id (0);
const u32 lid = get_local_id (0);
+ const u32 lsz = get_local_size (0);
+
+ /**
+ * sbox, kbox
+ */
+
+ __local u32 s_SPtrans[8][64];
+ __local u32 s_skb[8][64];
+
+ for (u32 i = lid; i < 64; i += lsz)
+ {
+ s_SPtrans[0][i] = c_SPtrans[0][i];
+ s_SPtrans[1][i] = c_SPtrans[1][i];
+ s_SPtrans[2][i] = c_SPtrans[2][i];
+ s_SPtrans[3][i] = c_SPtrans[3][i];
+ s_SPtrans[4][i] = c_SPtrans[4][i];
+ s_SPtrans[5][i] = c_SPtrans[5][i];
+ s_SPtrans[6][i] = c_SPtrans[6][i];
+ s_SPtrans[7][i] = c_SPtrans[7][i];
+
+ s_skb[0][i] = c_skb[0][i];
+ s_skb[1][i] = c_skb[1][i];
+ s_skb[2][i] = c_skb[2][i];
+ s_skb[3][i] = c_skb[3][i];
+ s_skb[4][i] = c_skb[4][i];
+ s_skb[5][i] = c_skb[5][i];
+ s_skb[6][i] = c_skb[6][i];
+ s_skb[7][i] = c_skb[7][i];
+ }
+
+ barrier (CLK_LOCAL_MEM_FENCE);
+
+ if (gid >= gid_max) return;
+
+ /**
+ * base
+ */
u32 w[16];
const u32 pw_len = pws[gid].pw_len;
+ /**
+ * main
+ */
+
+ m05500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
+}
+
+__kernel void m05500_s08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
+{
+ /**
+ * modifier
+ */
+
+ const u32 gid = get_global_id (0);
+ const u32 lid = get_local_id (0);
+ const u32 lsz = get_local_size (0);
+
/**
* sbox, kbox
*/
__local u32 s_SPtrans[8][64];
__local u32 s_skb[8][64];
- s_SPtrans[0][lid] = c_SPtrans[0][lid];
- s_SPtrans[1][lid] = c_SPtrans[1][lid];
- s_SPtrans[2][lid] = c_SPtrans[2][lid];
- s_SPtrans[3][lid] = c_SPtrans[3][lid];
- s_SPtrans[4][lid] = c_SPtrans[4][lid];
- s_SPtrans[5][lid] = c_SPtrans[5][lid];
- s_SPtrans[6][lid] = c_SPtrans[6][lid];
- s_SPtrans[7][lid] = c_SPtrans[7][lid];
-
- s_skb[0][lid] = c_skb[0][lid];
- s_skb[1][lid] = c_skb[1][lid];
- s_skb[2][lid] = c_skb[2][lid];
- s_skb[3][lid] = c_skb[3][lid];
- s_skb[4][lid] = c_skb[4][lid];
- s_skb[5][lid] = c_skb[5][lid];
- s_skb[6][lid] = c_skb[6][lid];
- s_skb[7][lid] = c_skb[7][lid];
+ for (u32 i = lid; i < 64; i += lsz)
+ {
+ s_SPtrans[0][i] = c_SPtrans[0][i];
+ s_SPtrans[1][i] = c_SPtrans[1][i];
+ s_SPtrans[2][i] = c_SPtrans[2][i];
+ s_SPtrans[3][i] = c_SPtrans[3][i];
+ s_SPtrans[4][i] = c_SPtrans[4][i];
+ s_SPtrans[5][i] = c_SPtrans[5][i];
+ s_SPtrans[6][i] = c_SPtrans[6][i];
+ s_SPtrans[7][i] = c_SPtrans[7][i];
+
+ s_skb[0][i] = c_skb[0][i];
+ s_skb[1][i] = c_skb[1][i];
+ s_skb[2][i] = c_skb[2][i];
+ s_skb[3][i] = c_skb[3][i];
+ s_skb[4][i] = c_skb[4][i];
+ s_skb[5][i] = c_skb[5][i];
+ s_skb[6][i] = c_skb[6][i];
+ s_skb[7][i] = c_skb[7][i];
+ }
barrier (CLK_LOCAL_MEM_FENCE);
if (gid >= gid_max) return;
- /**
- * main
- */
-
- m05500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
-}
-
-__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05500_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __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)
-{
/**
* base
*/
- const u32 gid = get_global_id (0);
- const u32 lid = get_local_id (0);
-
u32 w[16];
w[ 0] = pws[gid].i[ 0];
const u32 pw_len = pws[gid].pw_len;
- /**
- * sbox, kbox
- */
-
- __local u32 s_SPtrans[8][64];
- __local u32 s_skb[8][64];
-
- s_SPtrans[0][lid] = c_SPtrans[0][lid];
- s_SPtrans[1][lid] = c_SPtrans[1][lid];
- s_SPtrans[2][lid] = c_SPtrans[2][lid];
- s_SPtrans[3][lid] = c_SPtrans[3][lid];
- s_SPtrans[4][lid] = c_SPtrans[4][lid];
- s_SPtrans[5][lid] = c_SPtrans[5][lid];
- s_SPtrans[6][lid] = c_SPtrans[6][lid];
- s_SPtrans[7][lid] = c_SPtrans[7][lid];
-
- s_skb[0][lid] = c_skb[0][lid];
- s_skb[1][lid] = c_skb[1][lid];
- s_skb[2][lid] = c_skb[2][lid];
- s_skb[3][lid] = c_skb[3][lid];
- s_skb[4][lid] = c_skb[4][lid];
- s_skb[5][lid] = c_skb[5][lid];
- s_skb[6][lid] = c_skb[6][lid];
- s_skb[7][lid] = c_skb[7][lid];
-
- barrier (CLK_LOCAL_MEM_FENCE);
-
- if (gid >= gid_max) return;
-
/**
* main
*/
- m05500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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);
+ m05500s (s_SPtrans, s_skb, w, pw_len, pws, rules_buf, combs_buf, words_buf_r, 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_scryptV0_buf, d_scryptV1_buf, d_scryptV2_buf, d_scryptV3_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, il_cnt, digests_cnt, digests_offset);
}
-__kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m05500_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global u32 * words_buf_r, __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)
+__kernel void m05500_s16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant u32x * words_buf_r, __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
{
}