diff --git a/OpenCL/m05000_a0-optimized.cl b/OpenCL/m05000_a0-optimized.cl index cca63f96f..260e40324 100644 --- a/OpenCL/m05000_a0-optimized.cl +++ b/OpenCL/m05000_a0-optimized.cl @@ -30,40 +30,6 @@ __constant u64a keccakf_rndc[24] = #define KECCAK_ROUNDS 24 #endif -#define Theta1(s) (st[0 + s] ^ st[5 + s] ^ st[10 + s] ^ st[15 + s] ^ st[20 + s]) - -#define Theta2(s) \ -{ \ - st[ 0 + s] ^= t; \ - st[ 5 + s] ^= t; \ - st[10 + s] ^= t; \ - st[15 + s] ^= t; \ - st[20 + s] ^= t; \ -} - -#define Rho_Pi(s) \ -{ \ - u32 j = keccakf_piln[s]; \ - u32 k = keccakf_rotc[s]; \ - bc0 = st[j]; \ - st[j] = rotl64 (t, k); \ - t = bc0; \ -} - -#define Chi(s) \ -{ \ - bc0 = st[0 + s]; \ - bc1 = st[1 + s]; \ - bc2 = st[2 + s]; \ - bc3 = st[3 + s]; \ - bc4 = st[4 + s]; \ - st[0 + s] ^= ~bc1 & bc2; \ - st[1 + s] ^= ~bc2 & bc3; \ - st[2 + s] ^= ~bc3 & bc4; \ - st[3 + s] ^= ~bc4 & bc0; \ - st[4 + s] ^= ~bc0 & bc1; \ -} - __kernel void m05000_m04 (__global pw_t *pws, __constant const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const 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 u64 gid_max) { /** @@ -94,22 +60,6 @@ __kernel void m05000_m04 (__global pw_t *pws, __constant const kernel_rule_t *ru const u32 pw_len = pws[gid].pw_len; - /** - * constants - */ - - const int keccakf_rotc[24] = - { - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, - 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 - }; - - const int keccakf_piln[24] = - { - 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, - 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 - }; - /** * loop */ @@ -129,100 +79,162 @@ __kernel void m05000_m04 (__global pw_t *pws, __constant const kernel_rule_t *ru * Keccak */ - u64x st[25]; + u64x a00 = hl32_to_64 (w0[1], w0[0]); + u64x a01 = hl32_to_64 (w0[3], w0[2]); + u64x a02 = hl32_to_64 (w1[1], w1[0]); + u64x a03 = hl32_to_64 (w1[3], w1[2]); + u64x a04 = 0; + u64x a10 = 0; + u64x a11 = 0; + u64x a12 = 0; + u64x a13 = 0; + u64x a14 = 0; + u64x a20 = 0; + u64x a21 = 0; + u64x a22 = 0; + u64x a23 = 0; + u64x a24 = 0; + u64x a30 = 0; + u64x a31 = 0x8000000000000000; + u64x a32 = 0; + u64x a33 = 0; + u64x a34 = 0; + u64x a40 = 0; + u64x a41 = 0; + u64x a42 = 0; + u64x a43 = 0; + u64x a44 = 0; - st[ 0] = hl32_to_64 (w0[1], w0[0]); - st[ 1] = hl32_to_64 (w0[3], w0[2]); - st[ 2] = hl32_to_64 (w1[1], w1[0]); - st[ 3] = hl32_to_64 (w1[3], w1[2]); - st[ 4] = 0; - st[ 5] = 0; - st[ 6] = 0; - st[ 7] = 0; - st[ 8] = 0; - st[ 9] = 0; - st[10] = 0; - st[11] = 0; - st[12] = 0; - st[13] = 0; - st[14] = 0; - st[15] = 0; - st[16] = 0x8000000000000000; - st[17] = 0; - st[18] = 0; - st[19] = 0; - st[20] = 0; - st[21] = 0; - st[22] = 0; - st[23] = 0; - st[24] = 0; + #define Rho_Pi(ad,r) \ + bc0 = ad; \ + ad = rotl64 (t, r); \ + t = bc0; \ - int round; - - for (round = 0; round < KECCAK_ROUNDS; round++) + #ifdef _unroll + #pragma unroll + #endif + for (int round = 0; round < KECCAK_ROUNDS - 1; round++) { // Theta - u64x bc0 = Theta1 (0); - u64x bc1 = Theta1 (1); - u64x bc2 = Theta1 (2); - u64x bc3 = Theta1 (3); - u64x bc4 = Theta1 (4); + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; u64x t; - t = bc4 ^ rotl64 (bc1, 1); Theta2 (0); - t = bc0 ^ rotl64 (bc2, 1); Theta2 (1); - t = bc1 ^ rotl64 (bc3, 1); Theta2 (2); - t = bc2 ^ rotl64 (bc4, 1); Theta2 (3); - t = bc3 ^ rotl64 (bc0, 1); Theta2 (4); + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; a40 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a01 ^= t; a11 ^= t; a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; a42 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a14 ^= t; a24 ^= t; a34 ^= t; a44 ^= t; // Rho Pi - t = st[1]; + t = a01; - Rho_Pi (0); - Rho_Pi (1); - Rho_Pi (2); - Rho_Pi (3); - Rho_Pi (4); - Rho_Pi (5); - Rho_Pi (6); - Rho_Pi (7); - Rho_Pi (8); - Rho_Pi (9); - Rho_Pi (10); - Rho_Pi (11); - Rho_Pi (12); - Rho_Pi (13); - Rho_Pi (14); - Rho_Pi (15); - Rho_Pi (16); - Rho_Pi (17); - Rho_Pi (18); - Rho_Pi (19); - Rho_Pi (20); - Rho_Pi (21); - Rho_Pi (22); - Rho_Pi (23); + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + Rho_Pi (a40, 62); + Rho_Pi (a24, 18); + Rho_Pi (a42, 39); + Rho_Pi (a14, 61); + Rho_Pi (a11, 20); + Rho_Pi (a01, 44); // Chi - Chi (0); - Chi (5); - Chi (10); - Chi (15); - Chi (20); + bc0 = a00; bc1 = a01; bc2 = a02; bc3 = a03; bc4 = a04; + a00 ^= ~bc1 & bc2; a01 ^= ~bc2 & bc3; a02 ^= ~bc3 & bc4; a03 ^= ~bc4 & bc0; a04 ^= ~bc0 & bc1; + + bc0 = a10; bc1 = a11; bc2 = a12; bc3 = a13; bc4 = a14; + a10 ^= ~bc1 & bc2; a11 ^= ~bc2 & bc3; a12 ^= ~bc3 & bc4; a13 ^= ~bc4 & bc0; a14 ^= ~bc0 & bc1; + + bc0 = a20; bc1 = a21; bc2 = a22; bc3 = a23; bc4 = a24; + a20 ^= ~bc1 & bc2; a21 ^= ~bc2 & bc3; a22 ^= ~bc3 & bc4; a23 ^= ~bc4 & bc0; a24 ^= ~bc0 & bc1; + + bc0 = a30; bc1 = a31; bc2 = a32; bc3 = a33; bc4 = a34; + a30 ^= ~bc1 & bc2; a31 ^= ~bc2 & bc3; a32 ^= ~bc3 & bc4; a33 ^= ~bc4 & bc0; a34 ^= ~bc0 & bc1; + + bc0 = a40; bc1 = a41; bc2 = a42; bc3 = a43; bc4 = a44; + a40 ^= ~bc1 & bc2; a41 ^= ~bc2 & bc3; a42 ^= ~bc3 & bc4; a43 ^= ~bc4 & bc0; a44 ^= ~bc0 & bc1; // Iota - st[0] ^= keccakf_rndc[round]; + a00 ^= keccakf_rndc[round]; } - const u32x r0 = l32_from_64 (st[1]); - const u32x r1 = h32_from_64 (st[1]); - const u32x r2 = l32_from_64 (st[2]); - const u32x r3 = h32_from_64 (st[2]); + // Theta + + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; + + u64x t; + + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a34 ^= t; a44 ^= t; + + // Rho Pi + + t = a01; + + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + + #undef Rho_Pi + + bc0 = a00; + bc2 = a02; + bc3 = a03; + bc4 = a04; + + a02 ^= ~bc3 & bc4; + a03 ^= ~bc4 & bc0; + + const u32x r0 = l32_from_64 (a03); + const u32x r1 = h32_from_64 (a03); + const u32x r2 = l32_from_64 (a02); + const u32x r3 = h32_from_64 (a02); COMPARE_M_SIMD (r0, r1, r2, r3); } @@ -266,22 +278,6 @@ __kernel void m05000_s04 (__global pw_t *pws, __constant const kernel_rule_t *ru const u32 pw_len = pws[gid].pw_len; - /** - * constants - */ - - const int keccakf_rotc[24] = - { - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, - 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 - }; - - const int keccakf_piln[24] = - { - 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, - 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 - }; - /** * digest */ @@ -313,100 +309,162 @@ __kernel void m05000_s04 (__global pw_t *pws, __constant const kernel_rule_t *ru * Keccak */ - u64x st[25]; + u64x a00 = hl32_to_64 (w0[1], w0[0]); + u64x a01 = hl32_to_64 (w0[3], w0[2]); + u64x a02 = hl32_to_64 (w1[1], w1[0]); + u64x a03 = hl32_to_64 (w1[3], w1[2]); + u64x a04 = 0; + u64x a10 = 0; + u64x a11 = 0; + u64x a12 = 0; + u64x a13 = 0; + u64x a14 = 0; + u64x a20 = 0; + u64x a21 = 0; + u64x a22 = 0; + u64x a23 = 0; + u64x a24 = 0; + u64x a30 = 0; + u64x a31 = 0x8000000000000000; + u64x a32 = 0; + u64x a33 = 0; + u64x a34 = 0; + u64x a40 = 0; + u64x a41 = 0; + u64x a42 = 0; + u64x a43 = 0; + u64x a44 = 0; - st[ 0] = hl32_to_64 (w0[1], w0[0]); - st[ 1] = hl32_to_64 (w0[3], w0[2]); - st[ 2] = hl32_to_64 (w1[1], w1[0]); - st[ 3] = hl32_to_64 (w1[3], w1[2]); - st[ 4] = 0; - st[ 5] = 0; - st[ 6] = 0; - st[ 7] = 0; - st[ 8] = 0; - st[ 9] = 0; - st[10] = 0; - st[11] = 0; - st[12] = 0; - st[13] = 0; - st[14] = 0; - st[15] = 0; - st[16] = 0x8000000000000000; - st[17] = 0; - st[18] = 0; - st[19] = 0; - st[20] = 0; - st[21] = 0; - st[22] = 0; - st[23] = 0; - st[24] = 0; + #define Rho_Pi(ad,r) \ + bc0 = ad; \ + ad = rotl64 (t, r); \ + t = bc0; \ - int round; - - for (round = 0; round < KECCAK_ROUNDS; round++) + #ifdef _unroll + #pragma unroll + #endif + for (int round = 0; round < KECCAK_ROUNDS - 1; round++) { // Theta - u64x bc0 = Theta1 (0); - u64x bc1 = Theta1 (1); - u64x bc2 = Theta1 (2); - u64x bc3 = Theta1 (3); - u64x bc4 = Theta1 (4); + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; u64x t; - t = bc4 ^ rotl64 (bc1, 1); Theta2 (0); - t = bc0 ^ rotl64 (bc2, 1); Theta2 (1); - t = bc1 ^ rotl64 (bc3, 1); Theta2 (2); - t = bc2 ^ rotl64 (bc4, 1); Theta2 (3); - t = bc3 ^ rotl64 (bc0, 1); Theta2 (4); + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; a40 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a01 ^= t; a11 ^= t; a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; a42 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a14 ^= t; a24 ^= t; a34 ^= t; a44 ^= t; // Rho Pi - t = st[1]; + t = a01; - Rho_Pi (0); - Rho_Pi (1); - Rho_Pi (2); - Rho_Pi (3); - Rho_Pi (4); - Rho_Pi (5); - Rho_Pi (6); - Rho_Pi (7); - Rho_Pi (8); - Rho_Pi (9); - Rho_Pi (10); - Rho_Pi (11); - Rho_Pi (12); - Rho_Pi (13); - Rho_Pi (14); - Rho_Pi (15); - Rho_Pi (16); - Rho_Pi (17); - Rho_Pi (18); - Rho_Pi (19); - Rho_Pi (20); - Rho_Pi (21); - Rho_Pi (22); - Rho_Pi (23); + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + Rho_Pi (a40, 62); + Rho_Pi (a24, 18); + Rho_Pi (a42, 39); + Rho_Pi (a14, 61); + Rho_Pi (a11, 20); + Rho_Pi (a01, 44); // Chi - Chi (0); - Chi (5); - Chi (10); - Chi (15); - Chi (20); + bc0 = a00; bc1 = a01; bc2 = a02; bc3 = a03; bc4 = a04; + a00 ^= ~bc1 & bc2; a01 ^= ~bc2 & bc3; a02 ^= ~bc3 & bc4; a03 ^= ~bc4 & bc0; a04 ^= ~bc0 & bc1; + + bc0 = a10; bc1 = a11; bc2 = a12; bc3 = a13; bc4 = a14; + a10 ^= ~bc1 & bc2; a11 ^= ~bc2 & bc3; a12 ^= ~bc3 & bc4; a13 ^= ~bc4 & bc0; a14 ^= ~bc0 & bc1; + + bc0 = a20; bc1 = a21; bc2 = a22; bc3 = a23; bc4 = a24; + a20 ^= ~bc1 & bc2; a21 ^= ~bc2 & bc3; a22 ^= ~bc3 & bc4; a23 ^= ~bc4 & bc0; a24 ^= ~bc0 & bc1; + + bc0 = a30; bc1 = a31; bc2 = a32; bc3 = a33; bc4 = a34; + a30 ^= ~bc1 & bc2; a31 ^= ~bc2 & bc3; a32 ^= ~bc3 & bc4; a33 ^= ~bc4 & bc0; a34 ^= ~bc0 & bc1; + + bc0 = a40; bc1 = a41; bc2 = a42; bc3 = a43; bc4 = a44; + a40 ^= ~bc1 & bc2; a41 ^= ~bc2 & bc3; a42 ^= ~bc3 & bc4; a43 ^= ~bc4 & bc0; a44 ^= ~bc0 & bc1; // Iota - st[0] ^= keccakf_rndc[round]; + a00 ^= keccakf_rndc[round]; } - const u32x r0 = l32_from_64 (st[1]); - const u32x r1 = h32_from_64 (st[1]); - const u32x r2 = l32_from_64 (st[2]); - const u32x r3 = h32_from_64 (st[2]); + // Theta + + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; + + u64x t; + + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a34 ^= t; a44 ^= t; + + // Rho Pi + + t = a01; + + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + + #undef Rho_Pi + + bc0 = a00; + bc2 = a02; + bc3 = a03; + bc4 = a04; + + a02 ^= ~bc3 & bc4; + a03 ^= ~bc4 & bc0; + + const u32x r0 = l32_from_64 (a03); + const u32x r1 = h32_from_64 (a03); + const u32x r2 = l32_from_64 (a02); + const u32x r3 = h32_from_64 (a02); COMPARE_S_SIMD (r0, r1, r2, r3); } diff --git a/OpenCL/m05000_a1-optimized.cl b/OpenCL/m05000_a1-optimized.cl index 88792a1b6..39c370c52 100644 --- a/OpenCL/m05000_a1-optimized.cl +++ b/OpenCL/m05000_a1-optimized.cl @@ -28,40 +28,6 @@ __constant u64a keccakf_rndc[24] = #define KECCAK_ROUNDS 24 #endif -#define Theta1(s) (st[0 + s] ^ st[5 + s] ^ st[10 + s] ^ st[15 + s] ^ st[20 + s]) - -#define Theta2(s) \ -{ \ - st[ 0 + s] ^= t; \ - st[ 5 + s] ^= t; \ - st[10 + s] ^= t; \ - st[15 + s] ^= t; \ - st[20 + s] ^= t; \ -} - -#define Rho_Pi(s) \ -{ \ - u32 j = keccakf_piln[s]; \ - u32 k = keccakf_rotc[s]; \ - bc0 = st[j]; \ - st[j] = rotl64 (t, k); \ - t = bc0; \ -} - -#define Chi(s) \ -{ \ - bc0 = st[0 + s]; \ - bc1 = st[1 + s]; \ - bc2 = st[2 + s]; \ - bc3 = st[3 + s]; \ - bc4 = st[4 + s]; \ - st[0 + s] ^= ~bc1 & bc2; \ - st[1 + s] ^= ~bc2 & bc3; \ - st[2 + s] ^= ~bc3 & bc4; \ - st[3 + s] ^= ~bc4 & bc0; \ - st[4 + s] ^= ~bc0 & bc1; \ -} - __kernel void m05000_m04 (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const 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 u64 gid_max) { /** @@ -92,22 +58,6 @@ __kernel void m05000_m04 (__global pw_t *pws, __global const kernel_rule_t *rule const u32 pw_l_len = pws[gid].pw_len; - /** - * constants - */ - - const int keccakf_rotc[24] = - { - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, - 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 - }; - - const int keccakf_piln[24] = - { - 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, - 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 - }; - /** * loop */ @@ -185,105 +135,168 @@ __kernel void m05000_m04 (__global pw_t *pws, __global const kernel_rule_t *rule * Keccak */ - u64x st[25]; + u64x a00 = hl32_to_64 (w0[1], w0[0]); + u64x a01 = hl32_to_64 (w0[3], w0[2]); + u64x a02 = hl32_to_64 (w1[1], w1[0]); + u64x a03 = hl32_to_64 (w1[3], w1[2]); + u64x a04 = hl32_to_64 (w2[1], w2[0]); + u64x a10 = hl32_to_64 (w2[3], w2[2]); + u64x a11 = hl32_to_64 (w3[1], w3[0]); + u64x a12 = hl32_to_64 (w3[3], w3[2]); + u64x a13 = 0; + u64x a14 = 0; + u64x a20 = 0; + u64x a21 = 0; + u64x a22 = 0; + u64x a23 = 0; + u64x a24 = 0; + u64x a30 = 0; + u64x a31 = 0x8000000000000000; + u64x a32 = 0; + u64x a33 = 0; + u64x a34 = 0; + u64x a40 = 0; + u64x a41 = 0; + u64x a42 = 0; + u64x a43 = 0; + u64x a44 = 0; - st[ 0] = hl32_to_64 (w0[1], w0[0]); - st[ 1] = hl32_to_64 (w0[3], w0[2]); - st[ 2] = hl32_to_64 (w1[1], w1[0]); - st[ 3] = hl32_to_64 (w1[3], w1[2]); - st[ 4] = hl32_to_64 (w2[1], w2[0]); - st[ 5] = hl32_to_64 (w2[3], w2[2]); - st[ 6] = hl32_to_64 (w3[1], w3[0]); - st[ 7] = hl32_to_64 (w3[3], w3[2]); - st[ 8] = 0; - st[ 9] = 0; - st[10] = 0; - st[11] = 0; - st[12] = 0; - st[13] = 0; - st[14] = 0; - st[15] = 0; - st[16] = 0x8000000000000000; - st[17] = 0; - st[18] = 0; - st[19] = 0; - st[20] = 0; - st[21] = 0; - st[22] = 0; - st[23] = 0; - st[24] = 0; + #define Rho_Pi(ad,r) \ + bc0 = ad; \ + ad = rotl64 (t, r); \ + t = bc0; \ - int round; - - for (round = 0; round < KECCAK_ROUNDS; round++) + #ifdef _unroll + #pragma unroll + #endif + for (int round = 0; round < KECCAK_ROUNDS - 1; round++) { // Theta - u64x bc0 = Theta1 (0); - u64x bc1 = Theta1 (1); - u64x bc2 = Theta1 (2); - u64x bc3 = Theta1 (3); - u64x bc4 = Theta1 (4); + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; u64x t; - t = bc4 ^ rotl64 (bc1, 1); Theta2 (0); - t = bc0 ^ rotl64 (bc2, 1); Theta2 (1); - t = bc1 ^ rotl64 (bc3, 1); Theta2 (2); - t = bc2 ^ rotl64 (bc4, 1); Theta2 (3); - t = bc3 ^ rotl64 (bc0, 1); Theta2 (4); + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; a40 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a01 ^= t; a11 ^= t; a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; a42 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a14 ^= t; a24 ^= t; a34 ^= t; a44 ^= t; // Rho Pi - t = st[1]; + t = a01; - Rho_Pi (0); - Rho_Pi (1); - Rho_Pi (2); - Rho_Pi (3); - Rho_Pi (4); - Rho_Pi (5); - Rho_Pi (6); - Rho_Pi (7); - Rho_Pi (8); - Rho_Pi (9); - Rho_Pi (10); - Rho_Pi (11); - Rho_Pi (12); - Rho_Pi (13); - Rho_Pi (14); - Rho_Pi (15); - Rho_Pi (16); - Rho_Pi (17); - Rho_Pi (18); - Rho_Pi (19); - Rho_Pi (20); - Rho_Pi (21); - Rho_Pi (22); - Rho_Pi (23); + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + Rho_Pi (a40, 62); + Rho_Pi (a24, 18); + Rho_Pi (a42, 39); + Rho_Pi (a14, 61); + Rho_Pi (a11, 20); + Rho_Pi (a01, 44); // Chi - Chi (0); - Chi (5); - Chi (10); - Chi (15); - Chi (20); + bc0 = a00; bc1 = a01; bc2 = a02; bc3 = a03; bc4 = a04; + a00 ^= ~bc1 & bc2; a01 ^= ~bc2 & bc3; a02 ^= ~bc3 & bc4; a03 ^= ~bc4 & bc0; a04 ^= ~bc0 & bc1; + + bc0 = a10; bc1 = a11; bc2 = a12; bc3 = a13; bc4 = a14; + a10 ^= ~bc1 & bc2; a11 ^= ~bc2 & bc3; a12 ^= ~bc3 & bc4; a13 ^= ~bc4 & bc0; a14 ^= ~bc0 & bc1; + + bc0 = a20; bc1 = a21; bc2 = a22; bc3 = a23; bc4 = a24; + a20 ^= ~bc1 & bc2; a21 ^= ~bc2 & bc3; a22 ^= ~bc3 & bc4; a23 ^= ~bc4 & bc0; a24 ^= ~bc0 & bc1; + + bc0 = a30; bc1 = a31; bc2 = a32; bc3 = a33; bc4 = a34; + a30 ^= ~bc1 & bc2; a31 ^= ~bc2 & bc3; a32 ^= ~bc3 & bc4; a33 ^= ~bc4 & bc0; a34 ^= ~bc0 & bc1; + + bc0 = a40; bc1 = a41; bc2 = a42; bc3 = a43; bc4 = a44; + a40 ^= ~bc1 & bc2; a41 ^= ~bc2 & bc3; a42 ^= ~bc3 & bc4; a43 ^= ~bc4 & bc0; a44 ^= ~bc0 & bc1; // Iota - st[0] ^= keccakf_rndc[round]; + a00 ^= keccakf_rndc[round]; } - const u32x r0 = l32_from_64 (st[1]); - const u32x r1 = h32_from_64 (st[1]); - const u32x r2 = l32_from_64 (st[2]); - const u32x r3 = h32_from_64 (st[2]); + // Theta + + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; + + u64x t; + + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a34 ^= t; a44 ^= t; + + // Rho Pi + + t = a01; + + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + + #undef Rho_Pi + + bc0 = a00; + bc2 = a02; + bc3 = a03; + bc4 = a04; + + a02 ^= ~bc3 & bc4; + a03 ^= ~bc4 & bc0; + + const u32x r0 = l32_from_64 (a03); + const u32x r1 = h32_from_64 (a03); + const u32x r2 = l32_from_64 (a02); + const u32x r3 = h32_from_64 (a02); COMPARE_M_SIMD (r0, r1, r2, r3); } } + __kernel void m05000_m08 (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const 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 u64 gid_max) { } @@ -322,22 +335,6 @@ __kernel void m05000_s04 (__global pw_t *pws, __global const kernel_rule_t *rule const u32 pw_l_len = pws[gid].pw_len; - /** - * constants - */ - - const int keccakf_rotc[24] = - { - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, - 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 - }; - - const int keccakf_piln[24] = - { - 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, - 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 - }; - /** * digest */ @@ -427,100 +424,162 @@ __kernel void m05000_s04 (__global pw_t *pws, __global const kernel_rule_t *rule * Keccak */ - u64x st[25]; + u64x a00 = hl32_to_64 (w0[1], w0[0]); + u64x a01 = hl32_to_64 (w0[3], w0[2]); + u64x a02 = hl32_to_64 (w1[1], w1[0]); + u64x a03 = hl32_to_64 (w1[3], w1[2]); + u64x a04 = hl32_to_64 (w2[1], w2[0]); + u64x a10 = hl32_to_64 (w2[3], w2[2]); + u64x a11 = hl32_to_64 (w3[1], w3[0]); + u64x a12 = hl32_to_64 (w3[3], w3[2]); + u64x a13 = 0; + u64x a14 = 0; + u64x a20 = 0; + u64x a21 = 0; + u64x a22 = 0; + u64x a23 = 0; + u64x a24 = 0; + u64x a30 = 0; + u64x a31 = 0x8000000000000000; + u64x a32 = 0; + u64x a33 = 0; + u64x a34 = 0; + u64x a40 = 0; + u64x a41 = 0; + u64x a42 = 0; + u64x a43 = 0; + u64x a44 = 0; - st[ 0] = hl32_to_64 (w0[1], w0[0]); - st[ 1] = hl32_to_64 (w0[3], w0[2]); - st[ 2] = hl32_to_64 (w1[1], w1[0]); - st[ 3] = hl32_to_64 (w1[3], w1[2]); - st[ 4] = hl32_to_64 (w2[1], w2[0]); - st[ 5] = hl32_to_64 (w2[3], w2[2]); - st[ 6] = hl32_to_64 (w3[1], w3[0]); - st[ 7] = hl32_to_64 (w3[3], w3[2]); - st[ 8] = 0; - st[ 9] = 0; - st[10] = 0; - st[11] = 0; - st[12] = 0; - st[13] = 0; - st[14] = 0; - st[15] = 0; - st[16] = 0x8000000000000000; - st[17] = 0; - st[18] = 0; - st[19] = 0; - st[20] = 0; - st[21] = 0; - st[22] = 0; - st[23] = 0; - st[24] = 0; + #define Rho_Pi(ad,r) \ + bc0 = ad; \ + ad = rotl64 (t, r); \ + t = bc0; \ - int round; - - for (round = 0; round < KECCAK_ROUNDS; round++) + #ifdef _unroll + #pragma unroll + #endif + for (int round = 0; round < KECCAK_ROUNDS - 1; round++) { // Theta - u64x bc0 = Theta1 (0); - u64x bc1 = Theta1 (1); - u64x bc2 = Theta1 (2); - u64x bc3 = Theta1 (3); - u64x bc4 = Theta1 (4); + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; u64x t; - t = bc4 ^ rotl64 (bc1, 1); Theta2 (0); - t = bc0 ^ rotl64 (bc2, 1); Theta2 (1); - t = bc1 ^ rotl64 (bc3, 1); Theta2 (2); - t = bc2 ^ rotl64 (bc4, 1); Theta2 (3); - t = bc3 ^ rotl64 (bc0, 1); Theta2 (4); + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; a40 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a01 ^= t; a11 ^= t; a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; a42 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a14 ^= t; a24 ^= t; a34 ^= t; a44 ^= t; // Rho Pi - t = st[1]; + t = a01; - Rho_Pi (0); - Rho_Pi (1); - Rho_Pi (2); - Rho_Pi (3); - Rho_Pi (4); - Rho_Pi (5); - Rho_Pi (6); - Rho_Pi (7); - Rho_Pi (8); - Rho_Pi (9); - Rho_Pi (10); - Rho_Pi (11); - Rho_Pi (12); - Rho_Pi (13); - Rho_Pi (14); - Rho_Pi (15); - Rho_Pi (16); - Rho_Pi (17); - Rho_Pi (18); - Rho_Pi (19); - Rho_Pi (20); - Rho_Pi (21); - Rho_Pi (22); - Rho_Pi (23); + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + Rho_Pi (a40, 62); + Rho_Pi (a24, 18); + Rho_Pi (a42, 39); + Rho_Pi (a14, 61); + Rho_Pi (a11, 20); + Rho_Pi (a01, 44); // Chi - Chi (0); - Chi (5); - Chi (10); - Chi (15); - Chi (20); + bc0 = a00; bc1 = a01; bc2 = a02; bc3 = a03; bc4 = a04; + a00 ^= ~bc1 & bc2; a01 ^= ~bc2 & bc3; a02 ^= ~bc3 & bc4; a03 ^= ~bc4 & bc0; a04 ^= ~bc0 & bc1; + + bc0 = a10; bc1 = a11; bc2 = a12; bc3 = a13; bc4 = a14; + a10 ^= ~bc1 & bc2; a11 ^= ~bc2 & bc3; a12 ^= ~bc3 & bc4; a13 ^= ~bc4 & bc0; a14 ^= ~bc0 & bc1; + + bc0 = a20; bc1 = a21; bc2 = a22; bc3 = a23; bc4 = a24; + a20 ^= ~bc1 & bc2; a21 ^= ~bc2 & bc3; a22 ^= ~bc3 & bc4; a23 ^= ~bc4 & bc0; a24 ^= ~bc0 & bc1; + + bc0 = a30; bc1 = a31; bc2 = a32; bc3 = a33; bc4 = a34; + a30 ^= ~bc1 & bc2; a31 ^= ~bc2 & bc3; a32 ^= ~bc3 & bc4; a33 ^= ~bc4 & bc0; a34 ^= ~bc0 & bc1; + + bc0 = a40; bc1 = a41; bc2 = a42; bc3 = a43; bc4 = a44; + a40 ^= ~bc1 & bc2; a41 ^= ~bc2 & bc3; a42 ^= ~bc3 & bc4; a43 ^= ~bc4 & bc0; a44 ^= ~bc0 & bc1; // Iota - st[0] ^= keccakf_rndc[round]; + a00 ^= keccakf_rndc[round]; } - const u32x r0 = l32_from_64 (st[1]); - const u32x r1 = h32_from_64 (st[1]); - const u32x r2 = l32_from_64 (st[2]); - const u32x r3 = h32_from_64 (st[2]); + // Theta + + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; + + u64x t; + + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a34 ^= t; a44 ^= t; + + // Rho Pi + + t = a01; + + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + + #undef Rho_Pi + + bc0 = a00; + bc2 = a02; + bc3 = a03; + bc4 = a04; + + a02 ^= ~bc3 & bc4; + a03 ^= ~bc4 & bc0; + + const u32x r0 = l32_from_64 (a03); + const u32x r1 = h32_from_64 (a03); + const u32x r2 = l32_from_64 (a02); + const u32x r3 = h32_from_64 (a02); COMPARE_S_SIMD (r0, r1, r2, r3); } diff --git a/OpenCL/m05000_a3-optimized.cl b/OpenCL/m05000_a3-optimized.cl index a4fed83d0..7334426ba 100644 --- a/OpenCL/m05000_a3-optimized.cl +++ b/OpenCL/m05000_a3-optimized.cl @@ -28,40 +28,6 @@ __constant u64a keccakf_rndc[24] = #define KECCAK_ROUNDS 24 #endif -#define Theta1(s) (st[0 + s] ^ st[5 + s] ^ st[10 + s] ^ st[15 + s] ^ st[20 + s]) - -#define Theta2(s) \ -{ \ - st[ 0 + s] ^= t; \ - st[ 5 + s] ^= t; \ - st[10 + s] ^= t; \ - st[15 + s] ^= t; \ - st[20 + s] ^= t; \ -} - -#define Rho_Pi(s) \ -{ \ - u32 j = keccakf_piln[s]; \ - u32 k = keccakf_rotc[s]; \ - bc0 = st[j]; \ - st[j] = rotl64 (t, k); \ - t = bc0; \ -} - -#define Chi(s) \ -{ \ - bc0 = st[0 + s]; \ - bc1 = st[1 + s]; \ - bc2 = st[2 + s]; \ - bc3 = st[3 + s]; \ - bc4 = st[4 + s]; \ - st[0 + s] ^= ~bc1 & bc2; \ - st[1 + s] ^= ~bc2 & bc3; \ - st[2 + s] ^= ~bc3 & bc4; \ - st[3 + s] ^= ~bc4 & bc0; \ - st[4 + s] ^= ~bc0 & bc1; \ -} - void m05000m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const 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) { /** @@ -71,22 +37,6 @@ void m05000m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __gl const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); - /** - * constants - */ - - const int keccakf_rotc[24] = - { - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, - 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 - }; - - const int keccakf_piln[24] = - { - 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, - 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 - }; - /** * loop */ @@ -99,115 +49,166 @@ void m05000m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __gl const u32x w0lr = w0l | w0r; - u32x t0[4]; - u32x t1[4]; - u32x t2[4]; - u32x t3[4]; - - t0[0] = w0lr; - t0[1] = w0[1]; - t0[2] = w0[2]; - t0[3] = w0[3]; - t1[0] = w1[0]; - t1[1] = w1[1]; - t1[2] = w1[2]; - t1[3] = w1[3]; - t2[0] = w2[0]; - t2[1] = w2[1]; - t2[2] = w2[2]; - t2[3] = w2[3]; - t3[0] = w3[0]; - t3[1] = w3[1]; - t3[2] = w3[2]; - t3[3] = w3[3]; - /** * Keccak */ - u64x st[25]; + u64x a00 = hl32_to_64 (w0[1], w0lr); + u64x a01 = hl32_to_64 (w0[3], w0[2]); + u64x a02 = hl32_to_64 (w1[1], w1[0]); + u64x a03 = hl32_to_64 (w1[3], w1[2]); + u64x a04 = hl32_to_64 (w2[1], w2[0]); + u64x a10 = hl32_to_64 (w2[3], w2[2]); + u64x a11 = hl32_to_64 (w3[1], w3[0]); + u64x a12 = hl32_to_64 (w3[3], w3[2]); + u64x a13 = 0; + u64x a14 = 0; + u64x a20 = 0; + u64x a21 = 0; + u64x a22 = 0; + u64x a23 = 0; + u64x a24 = 0; + u64x a30 = 0; + u64x a31 = 0x8000000000000000; + u64x a32 = 0; + u64x a33 = 0; + u64x a34 = 0; + u64x a40 = 0; + u64x a41 = 0; + u64x a42 = 0; + u64x a43 = 0; + u64x a44 = 0; - st[ 0] = hl32_to_64 (t0[1], t0[0]); - st[ 1] = hl32_to_64 (t0[3], t0[2]); - st[ 2] = hl32_to_64 (t1[1], t1[0]); - st[ 3] = hl32_to_64 (t1[3], t1[2]); - st[ 4] = hl32_to_64 (t2[1], t2[0]); - st[ 5] = hl32_to_64 (t2[3], t2[2]); - st[ 6] = hl32_to_64 (t3[1], t3[0]); - st[ 7] = hl32_to_64 (t3[3], t3[2]); - st[ 8] = 0; - st[ 9] = 0; - st[10] = 0; - st[11] = 0; - st[12] = 0; - st[13] = 0; - st[14] = 0; - st[15] = 0; - st[16] = 0x8000000000000000; - st[17] = 0; - st[18] = 0; - st[19] = 0; - st[20] = 0; - st[21] = 0; - st[22] = 0; - st[23] = 0; - st[24] = 0; + #define Rho_Pi(ad,r) \ + bc0 = ad; \ + ad = rotl64 (t, r); \ + t = bc0; \ - int round; - - for (round = 0; round < KECCAK_ROUNDS; round++) + #ifdef _unroll + #pragma unroll + #endif + for (int round = 0; round < KECCAK_ROUNDS - 1; round++) { // Theta - u64x bc0 = Theta1 (0); - u64x bc1 = Theta1 (1); - u64x bc2 = Theta1 (2); - u64x bc3 = Theta1 (3); - u64x bc4 = Theta1 (4); + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; u64x t; - t = bc4 ^ rotl64 (bc1, 1); Theta2 (0); - t = bc0 ^ rotl64 (bc2, 1); Theta2 (1); - t = bc1 ^ rotl64 (bc3, 1); Theta2 (2); - t = bc2 ^ rotl64 (bc4, 1); Theta2 (3); - t = bc3 ^ rotl64 (bc0, 1); Theta2 (4); + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; a40 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a01 ^= t; a11 ^= t; a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; a42 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a14 ^= t; a24 ^= t; a34 ^= t; a44 ^= t; // Rho Pi - t = st[1]; + t = a01; - #ifdef _unroll - #pragma unroll - #else - #pragma unroll 1 - #endif - for (int i = 0; i < 24; i++) - { - Rho_Pi (i); - } + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + Rho_Pi (a40, 62); + Rho_Pi (a24, 18); + Rho_Pi (a42, 39); + Rho_Pi (a14, 61); + Rho_Pi (a11, 20); + Rho_Pi (a01, 44); // Chi - #ifdef _unroll - #pragma unroll - #else - #pragma unroll 1 - #endif - for (int i = 0; i < 25; i += 5) - { - Chi (i); - } + bc0 = a00; bc1 = a01; bc2 = a02; bc3 = a03; bc4 = a04; + a00 ^= ~bc1 & bc2; a01 ^= ~bc2 & bc3; a02 ^= ~bc3 & bc4; a03 ^= ~bc4 & bc0; a04 ^= ~bc0 & bc1; + + bc0 = a10; bc1 = a11; bc2 = a12; bc3 = a13; bc4 = a14; + a10 ^= ~bc1 & bc2; a11 ^= ~bc2 & bc3; a12 ^= ~bc3 & bc4; a13 ^= ~bc4 & bc0; a14 ^= ~bc0 & bc1; + + bc0 = a20; bc1 = a21; bc2 = a22; bc3 = a23; bc4 = a24; + a20 ^= ~bc1 & bc2; a21 ^= ~bc2 & bc3; a22 ^= ~bc3 & bc4; a23 ^= ~bc4 & bc0; a24 ^= ~bc0 & bc1; + + bc0 = a30; bc1 = a31; bc2 = a32; bc3 = a33; bc4 = a34; + a30 ^= ~bc1 & bc2; a31 ^= ~bc2 & bc3; a32 ^= ~bc3 & bc4; a33 ^= ~bc4 & bc0; a34 ^= ~bc0 & bc1; + + bc0 = a40; bc1 = a41; bc2 = a42; bc3 = a43; bc4 = a44; + a40 ^= ~bc1 & bc2; a41 ^= ~bc2 & bc3; a42 ^= ~bc3 & bc4; a43 ^= ~bc4 & bc0; a44 ^= ~bc0 & bc1; // Iota - st[0] ^= keccakf_rndc[round]; + a00 ^= keccakf_rndc[round]; } - const u32x r0 = l32_from_64 (st[1]); - const u32x r1 = h32_from_64 (st[1]); - const u32x r2 = l32_from_64 (st[2]); - const u32x r3 = h32_from_64 (st[2]); + // Theta + + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; + + u64x t; + + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a34 ^= t; a44 ^= t; + + // Rho Pi + + t = a01; + + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + + #undef Rho_Pi + + bc0 = a00; + bc2 = a02; + bc3 = a03; + bc4 = a04; + + a02 ^= ~bc3 & bc4; + a03 ^= ~bc4 & bc0; + + const u32x r0 = l32_from_64 (a03); + const u32x r1 = h32_from_64 (a03); + const u32x r2 = l32_from_64 (a02); + const u32x r3 = h32_from_64 (a02); COMPARE_M_SIMD (r0, r1, r2, r3); } @@ -222,22 +223,6 @@ void m05000s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __gl const u64 gid = get_global_id (0); const u64 lid = get_local_id (0); - /** - * constants - */ - - const int keccakf_rotc[24] = - { - 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, - 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 - }; - - const int keccakf_piln[24] = - { - 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, - 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 - }; - /** * digest */ @@ -262,115 +247,166 @@ void m05000s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_len, __gl const u32x w0lr = w0l | w0r; - u32x t0[4]; - u32x t1[4]; - u32x t2[4]; - u32x t3[4]; - - t0[0] = w0lr; - t0[1] = w0[1]; - t0[2] = w0[2]; - t0[3] = w0[3]; - t1[0] = w1[0]; - t1[1] = w1[1]; - t1[2] = w1[2]; - t1[3] = w1[3]; - t2[0] = w2[0]; - t2[1] = w2[1]; - t2[2] = w2[2]; - t2[3] = w2[3]; - t3[0] = w3[0]; - t3[1] = w3[1]; - t3[2] = w3[2]; - t3[3] = w3[3]; - /** * Keccak */ - u64x st[25]; + u64x a00 = hl32_to_64 (w0[1], w0lr); + u64x a01 = hl32_to_64 (w0[3], w0[2]); + u64x a02 = hl32_to_64 (w1[1], w1[0]); + u64x a03 = hl32_to_64 (w1[3], w1[2]); + u64x a04 = hl32_to_64 (w2[1], w2[0]); + u64x a10 = hl32_to_64 (w2[3], w2[2]); + u64x a11 = hl32_to_64 (w3[1], w3[0]); + u64x a12 = hl32_to_64 (w3[3], w3[2]); + u64x a13 = 0; + u64x a14 = 0; + u64x a20 = 0; + u64x a21 = 0; + u64x a22 = 0; + u64x a23 = 0; + u64x a24 = 0; + u64x a30 = 0; + u64x a31 = 0x8000000000000000; + u64x a32 = 0; + u64x a33 = 0; + u64x a34 = 0; + u64x a40 = 0; + u64x a41 = 0; + u64x a42 = 0; + u64x a43 = 0; + u64x a44 = 0; - st[ 0] = hl32_to_64 (t0[1], t0[0]); - st[ 1] = hl32_to_64 (t0[3], t0[2]); - st[ 2] = hl32_to_64 (t1[1], t1[0]); - st[ 3] = hl32_to_64 (t1[3], t1[2]); - st[ 4] = hl32_to_64 (t2[1], t2[0]); - st[ 5] = hl32_to_64 (t2[3], t2[2]); - st[ 6] = hl32_to_64 (t3[1], t3[0]); - st[ 7] = hl32_to_64 (t3[3], t3[2]); - st[ 8] = 0; - st[ 9] = 0; - st[10] = 0; - st[11] = 0; - st[12] = 0; - st[13] = 0; - st[14] = 0; - st[15] = 0; - st[16] = 0x8000000000000000; - st[17] = 0; - st[18] = 0; - st[19] = 0; - st[20] = 0; - st[21] = 0; - st[22] = 0; - st[23] = 0; - st[24] = 0; + #define Rho_Pi(ad,r) \ + bc0 = ad; \ + ad = rotl64 (t, r); \ + t = bc0; \ - int round; - - for (round = 0; round < KECCAK_ROUNDS; round++) + #ifdef _unroll + #pragma unroll + #endif + for (int round = 0; round < KECCAK_ROUNDS - 1; round++) { // Theta - u64x bc0 = Theta1 (0); - u64x bc1 = Theta1 (1); - u64x bc2 = Theta1 (2); - u64x bc3 = Theta1 (3); - u64x bc4 = Theta1 (4); + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; u64x t; - t = bc4 ^ rotl64 (bc1, 1); Theta2 (0); - t = bc0 ^ rotl64 (bc2, 1); Theta2 (1); - t = bc1 ^ rotl64 (bc3, 1); Theta2 (2); - t = bc2 ^ rotl64 (bc4, 1); Theta2 (3); - t = bc3 ^ rotl64 (bc0, 1); Theta2 (4); + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; a40 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a01 ^= t; a11 ^= t; a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; a42 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a14 ^= t; a24 ^= t; a34 ^= t; a44 ^= t; // Rho Pi - t = st[1]; + t = a01; - #ifdef _unroll - #pragma unroll - #else - #pragma unroll 1 - #endif - for (int i = 0; i < 24; i++) - { - Rho_Pi (i); - } + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + Rho_Pi (a40, 62); + Rho_Pi (a24, 18); + Rho_Pi (a42, 39); + Rho_Pi (a14, 61); + Rho_Pi (a11, 20); + Rho_Pi (a01, 44); // Chi - #ifdef _unroll - #pragma unroll - #else - #pragma unroll 1 - #endif - for (int i = 0; i < 25; i += 5) - { - Chi (i); - } + bc0 = a00; bc1 = a01; bc2 = a02; bc3 = a03; bc4 = a04; + a00 ^= ~bc1 & bc2; a01 ^= ~bc2 & bc3; a02 ^= ~bc3 & bc4; a03 ^= ~bc4 & bc0; a04 ^= ~bc0 & bc1; + + bc0 = a10; bc1 = a11; bc2 = a12; bc3 = a13; bc4 = a14; + a10 ^= ~bc1 & bc2; a11 ^= ~bc2 & bc3; a12 ^= ~bc3 & bc4; a13 ^= ~bc4 & bc0; a14 ^= ~bc0 & bc1; + + bc0 = a20; bc1 = a21; bc2 = a22; bc3 = a23; bc4 = a24; + a20 ^= ~bc1 & bc2; a21 ^= ~bc2 & bc3; a22 ^= ~bc3 & bc4; a23 ^= ~bc4 & bc0; a24 ^= ~bc0 & bc1; + + bc0 = a30; bc1 = a31; bc2 = a32; bc3 = a33; bc4 = a34; + a30 ^= ~bc1 & bc2; a31 ^= ~bc2 & bc3; a32 ^= ~bc3 & bc4; a33 ^= ~bc4 & bc0; a34 ^= ~bc0 & bc1; + + bc0 = a40; bc1 = a41; bc2 = a42; bc3 = a43; bc4 = a44; + a40 ^= ~bc1 & bc2; a41 ^= ~bc2 & bc3; a42 ^= ~bc3 & bc4; a43 ^= ~bc4 & bc0; a44 ^= ~bc0 & bc1; // Iota - st[0] ^= keccakf_rndc[round]; + a00 ^= keccakf_rndc[round]; } - const u32x r0 = l32_from_64 (st[1]); - const u32x r1 = h32_from_64 (st[1]); - const u32x r2 = l32_from_64 (st[2]); - const u32x r3 = h32_from_64 (st[2]); + // Theta + + u64x bc0 = a00 ^ a10 ^ a20 ^ a30 ^ a40; + u64x bc1 = a01 ^ a11 ^ a21 ^ a31 ^ a41; + u64x bc2 = a02 ^ a12 ^ a22 ^ a32 ^ a42; + u64x bc3 = a03 ^ a13 ^ a23 ^ a33 ^ a43; + u64x bc4 = a04 ^ a14 ^ a24 ^ a34 ^ a44; + + u64x t; + + t = bc4 ^ rotl64 (bc1, 1); a00 ^= t; a10 ^= t; a20 ^= t; a30 ^= t; + t = bc0 ^ rotl64 (bc2, 1); a21 ^= t; a31 ^= t; a41 ^= t; + t = bc1 ^ rotl64 (bc3, 1); a02 ^= t; a12 ^= t; a22 ^= t; a32 ^= t; + t = bc2 ^ rotl64 (bc4, 1); a03 ^= t; a13 ^= t; a23 ^= t; a33 ^= t; a43 ^= t; + t = bc3 ^ rotl64 (bc0, 1); a04 ^= t; a34 ^= t; a44 ^= t; + + // Rho Pi + + t = a01; + + Rho_Pi (a20, 1); + Rho_Pi (a12, 3); + Rho_Pi (a21, 6); + Rho_Pi (a32, 10); + Rho_Pi (a33, 15); + Rho_Pi (a03, 21); + Rho_Pi (a10, 28); + Rho_Pi (a31, 36); + Rho_Pi (a13, 45); + Rho_Pi (a41, 55); + Rho_Pi (a44, 2); + Rho_Pi (a04, 14); + Rho_Pi (a30, 27); + Rho_Pi (a43, 41); + Rho_Pi (a34, 56); + Rho_Pi (a23, 8); + Rho_Pi (a22, 25); + Rho_Pi (a02, 43); + + #undef Rho_Pi + + bc0 = a00; + bc2 = a02; + bc3 = a03; + bc4 = a04; + + a02 ^= ~bc3 & bc4; + a03 ^= ~bc4 & bc0; + + const u32x r0 = l32_from_64 (a03); + const u32x r1 = h32_from_64 (a03); + const u32x r2 = l32_from_64 (a02); + const u32x r3 = h32_from_64 (a02); COMPARE_S_SIMD (r0, r1, r2, r3); } diff --git a/docs/changes.txt b/docs/changes.txt index 7dae65ace..a0e562c11 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -50,6 +50,7 @@ - OpenCL Kernels: Move from ld.global.v4.u32 to ld.const.v4.u32 in _a3 kernels - OpenCL Kernels: Replace bitwise swaps with rotate() versions for AMD - OpenCL Kernels: Rewritten SIP kernel from scratch +- OpenCL Kernels: Rewritten Keccak kernel to run fully on registers and partially reversed last round - OpenCL Kernels: Updated default scrypt TMTO to be ideal for latest NVidia and AMD top models - OpenCL Kernels: Vectorized tons of slow kernels to improve CPU cracking speed - OpenCL Runtime: Updated AMD ROCm driver version check, warn if version < 1.1 diff --git a/src/interface.c b/src/interface.c index 45d5abbc7..4f10acaa6 100644 --- a/src/interface.c +++ b/src/interface.c @@ -21745,8 +21745,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_USES_BITS_64 | OPTI_TYPE_RAW_HASH; - hashconfig->dgst_pos0 = 2; - hashconfig->dgst_pos1 = 3; + hashconfig->dgst_pos0 = 6; + hashconfig->dgst_pos1 = 7; hashconfig->dgst_pos2 = 4; hashconfig->dgst_pos3 = 5; hashconfig->st_hash = ST_HASH_05000;