Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch for hashcat: adds sha1(sha512($pass))
From 7edbab0fced1a37f54418bca7db49c95cde21adc Mon Sep 17 00:00:00 2001
From: Michael Sprecher <sprecher.m@gmail.com>
Date: Mon, 28 Aug 2017 23:10:30 +0200
Subject: [PATCH 1/1] Added new hash-mode (incomplete) 20000 = sha1(sha512())
This patch adds sha1(sha512($pass)) to hashcat but it is incomplete.
Only the a1 kernels are implemented. That means you can only use the attack modes
1 - Combination
6 - Hybrid Wordlist + Mask
7 - Hybrid Mask + Wordlist
Adding the a0 and a3 kernels isn't much more work but we didn't need them
for cracking some of the Pwned Passwords hashes [1].
Adding them would be a good exercise for anyone interested in hacking on
hashcat. Here are the instructions to apply this patch:
$ git clone https://github.com/hashcat/hashcat
$ cd hashcat
$ git checkout 99f416435e4750dfb49a6e3cd99e1e12b80dc309
$ git apply 0001-Added-new-hash-mode-incomplete-20000-sha1-sha512.patch
[1] https://haveibeenpwned.com/Passwords
---
OpenCL/m20000_a1-optimized.cl | 624 ++++++++++++++++++++++++++++++++++++++++++
OpenCL/m20000_a1.cl | 251 +++++++++++++++++
include/interface.h | 1 +
src/interface.c | 26 ++
src/usage.c | 1 +
5 files changed, 903 insertions(+)
create mode 100644 OpenCL/m20000_a1-optimized.cl
create mode 100644 OpenCL/m20000_a1.cl
diff --git a/OpenCL/m20000_a1-optimized.cl b/OpenCL/m20000_a1-optimized.cl
new file mode 100644
index 00000000..9fa7e037
--- /dev/null
+++ b/OpenCL/m20000_a1-optimized.cl
@@ -0,0 +1,624 @@
+/**
+ * Author......: See docs/credits.txt
+ * License.....: MIT
+ */
+
+#define NEW_SIMD_CODE
+
+#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"
+#include "inc_hash_sha1.cl"
+
+#if VECT_SIZE == 1
+#define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i)])
+#elif VECT_SIZE == 2
+#define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
+#elif VECT_SIZE == 4
+#define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
+#elif VECT_SIZE == 8
+#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])
+#elif VECT_SIZE == 16
+#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])
+#endif
+
+__constant u64a k_sha512[80] =
+{
+ SHA512C00, SHA512C01, SHA512C02, SHA512C03,
+ SHA512C04, SHA512C05, SHA512C06, SHA512C07,
+ SHA512C08, SHA512C09, SHA512C0a, SHA512C0b,
+ SHA512C0c, SHA512C0d, SHA512C0e, SHA512C0f,
+ SHA512C10, SHA512C11, SHA512C12, SHA512C13,
+ SHA512C14, SHA512C15, SHA512C16, SHA512C17,
+ SHA512C18, SHA512C19, SHA512C1a, SHA512C1b,
+ SHA512C1c, SHA512C1d, SHA512C1e, SHA512C1f,
+ SHA512C20, SHA512C21, SHA512C22, SHA512C23,
+ SHA512C24, SHA512C25, SHA512C26, SHA512C27,
+ SHA512C28, SHA512C29, SHA512C2a, SHA512C2b,
+ SHA512C2c, SHA512C2d, SHA512C2e, SHA512C2f,
+ SHA512C30, SHA512C31, SHA512C32, SHA512C33,
+ SHA512C34, SHA512C35, SHA512C36, SHA512C37,
+ SHA512C38, SHA512C39, SHA512C3a, SHA512C3b,
+ SHA512C3c, SHA512C3d, SHA512C3e, SHA512C3f,
+ SHA512C40, SHA512C41, SHA512C42, SHA512C43,
+ SHA512C44, SHA512C45, SHA512C46, SHA512C47,
+ SHA512C48, SHA512C49, SHA512C4a, SHA512C4b,
+ SHA512C4c, SHA512C4d, SHA512C4e, SHA512C4f,
+};
+
+void sha512_transform (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u64x digest[8])
+{
+ u64x w0_t = hl32_to_64 (w0[0], w0[1]);
+ u64x w1_t = hl32_to_64 (w0[2], w0[3]);
+ u64x w2_t = hl32_to_64 (w1[0], w1[1]);
+ u64x w3_t = hl32_to_64 (w1[2], w1[3]);
+ u64x w4_t = hl32_to_64 (w2[0], w2[1]);
+ u64x w5_t = hl32_to_64 (w2[2], w2[3]);
+ u64x w6_t = hl32_to_64 (w3[0], w3[1]);
+ u64x w7_t = 0;
+ u64x w8_t = 0;
+ u64x w9_t = 0;
+ u64x wa_t = 0;
+ u64x wb_t = 0;
+ u64x wc_t = 0;
+ u64x wd_t = 0;
+ u64x we_t = 0;
+ u64x wf_t = hl32_to_64 (w3[2], w3[3]);
+
+ u64x a = digest[0];
+ u64x b = digest[1];
+ u64x c = digest[2];
+ u64x d = digest[3];
+ u64x e = digest[4];
+ u64x f = digest[5];
+ u64x g = digest[6];
+ u64x h = digest[7];
+
+ #define ROUND_EXPAND() \
+ { \
+ w0_t = SHA512_EXPAND (we_t, w9_t, w1_t, w0_t); \
+ w1_t = SHA512_EXPAND (wf_t, wa_t, w2_t, w1_t); \
+ w2_t = SHA512_EXPAND (w0_t, wb_t, w3_t, w2_t); \
+ w3_t = SHA512_EXPAND (w1_t, wc_t, w4_t, w3_t); \
+ w4_t = SHA512_EXPAND (w2_t, wd_t, w5_t, w4_t); \
+ w5_t = SHA512_EXPAND (w3_t, we_t, w6_t, w5_t); \
+ w6_t = SHA512_EXPAND (w4_t, wf_t, w7_t, w6_t); \
+ w7_t = SHA512_EXPAND (w5_t, w0_t, w8_t, w7_t); \
+ w8_t = SHA512_EXPAND (w6_t, w1_t, w9_t, w8_t); \
+ w9_t = SHA512_EXPAND (w7_t, w2_t, wa_t, w9_t); \
+ wa_t = SHA512_EXPAND (w8_t, w3_t, wb_t, wa_t); \
+ wb_t = SHA512_EXPAND (w9_t, w4_t, wc_t, wb_t); \
+ wc_t = SHA512_EXPAND (wa_t, w5_t, wd_t, wc_t); \
+ wd_t = SHA512_EXPAND (wb_t, w6_t, we_t, wd_t); \
+ we_t = SHA512_EXPAND (wc_t, w7_t, wf_t, we_t); \
+ wf_t = SHA512_EXPAND (wd_t, w8_t, w0_t, wf_t); \
+ }
+
+ #define ROUND_STEP(i) \
+ { \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w0_t, k_sha512[i + 0]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w1_t, k_sha512[i + 1]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, w2_t, k_sha512[i + 2]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, w3_t, k_sha512[i + 3]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, w4_t, k_sha512[i + 4]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, w5_t, k_sha512[i + 5]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, w6_t, k_sha512[i + 6]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, w7_t, k_sha512[i + 7]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, a, b, c, d, e, f, g, h, w8_t, k_sha512[i + 8]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, h, a, b, c, d, e, f, g, w9_t, k_sha512[i + 9]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, g, h, a, b, c, d, e, f, wa_t, k_sha512[i + 10]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, f, g, h, a, b, c, d, e, wb_t, k_sha512[i + 11]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, e, f, g, h, a, b, c, d, wc_t, k_sha512[i + 12]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, d, e, f, g, h, a, b, c, wd_t, k_sha512[i + 13]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, c, d, e, f, g, h, a, b, we_t, k_sha512[i + 14]); \
+ SHA512_STEP (SHA512_F0o, SHA512_F1o, b, c, d, e, f, g, h, a, wf_t, k_sha512[i + 15]); \
+ }
+
+ ROUND_STEP (0);
+
+ #ifdef _unroll
+ #pragma unroll
+ #endif
+ for (int i = 16; i < 80; i += 16)
+ {
+ ROUND_EXPAND (); ROUND_STEP (i);
+ }
+
+ /* rev
+ digest[0] += a;
+ digest[1] += b;
+ digest[2] += c;
+ digest[3] += d;
+ digest[4] += e;
+ digest[5] += f;
+ digest[6] += g;
+ digest[7] += h;
+ */
+
+ digest[0] = a;
+ digest[1] = b;
+ digest[2] = c;
+ digest[3] = d;
+ digest[4] = e;
+ digest[5] = f;
+ digest[6] = g;
+ digest[7] = h;
+}
+
+__kernel void m20000_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)
+{
+ /**
+ * modifier
+ */
+
+ const u64 lid = get_local_id (0);
+
+ /**
+ * base
+ */
+
+ const u64 gid = get_global_id (0);
+ const u32 lsz = get_local_size (0);
+
+ /**
+ * bin2asc table
+ */
+
+ __local u32 l_bin2asc[256];
+
+ for (u32 i = lid; i < 256; i += lsz)
+ {
+ const u32 i0 = (i >> 0) & 15;
+ const u32 i1 = (i >> 4) & 15;
+
+ l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
+ | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
+ }
+
+ barrier (CLK_LOCAL_MEM_FENCE);
+
+ if (gid >= gid_max) return;
+
+ u32 pw_buf0[4];
+ u32 pw_buf1[4];
+
+ pw_buf0[0] = pws[gid].i[0];
+ pw_buf0[1] = pws[gid].i[1];
+ pw_buf0[2] = pws[gid].i[2];
+ pw_buf0[3] = pws[gid].i[3];
+ pw_buf1[0] = pws[gid].i[4];
+ pw_buf1[1] = pws[gid].i[5];
+ pw_buf1[2] = pws[gid].i[6];
+ pw_buf1[3] = pws[gid].i[7];
+
+ const u32 pw_l_len = pws[gid].pw_len;
+
+ /**
+ * loop
+ */
+
+ for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
+ {
+ const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
+
+ const u32x pw_len = pw_l_len + pw_r_len;
+
+ /**
+ * concat password candidate
+ */
+
+ u32x wordl0[4] = { 0 };
+ u32x wordl1[4] = { 0 };
+ u32x wordl2[4] = { 0 };
+ u32x wordl3[4] = { 0 };
+
+ wordl0[0] = pw_buf0[0];
+ wordl0[1] = pw_buf0[1];
+ wordl0[2] = pw_buf0[2];
+ wordl0[3] = pw_buf0[3];
+ wordl1[0] = pw_buf1[0];
+ wordl1[1] = pw_buf1[1];
+ wordl1[2] = pw_buf1[2];
+ wordl1[3] = pw_buf1[3];
+
+ u32x wordr0[4] = { 0 };
+ u32x wordr1[4] = { 0 };
+ u32x wordr2[4] = { 0 };
+ u32x wordr3[4] = { 0 };
+
+ wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
+ wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
+ wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
+ wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
+ wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
+ wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
+ wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
+ wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
+
+ if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
+ {
+ switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
+ }
+ else
+ {
+ switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
+ }
+
+ u32x w0[4];
+ u32x w1[4];
+ u32x w2[4];
+ u32x w3[4];
+
+ w0[0] = wordl0[0] | wordr0[0];
+ w0[1] = wordl0[1] | wordr0[1];
+ w0[2] = wordl0[2] | wordr0[2];
+ w0[3] = wordl0[3] | wordr0[3];
+ w1[0] = wordl1[0] | wordr1[0];
+ w1[1] = wordl1[1] | wordr1[1];
+ w1[2] = wordl1[2] | wordr1[2];
+ w1[3] = wordl1[3] | wordr1[3];
+ w2[0] = wordl2[0] | wordr2[0];
+ w2[1] = wordl2[1] | wordr2[1];
+ w2[2] = wordl2[2] | wordr2[2];
+ w2[3] = wordl2[3] | wordr2[3];
+ w3[0] = wordl3[0] | wordr3[0];
+ w3[1] = wordl3[1] | wordr3[1];
+ w3[2] = wordl3[2] | wordr3[2];
+ w3[3] = wordl3[3] | wordr3[3];
+
+ /**
+ * sha512
+ */
+
+ u32x w0_t[4];
+ u32x w1_t[4];
+ u32x w2_t[4];
+ u32x w3_t[4];
+
+ w0_t[0] = swap32 (w0[0]);
+ w0_t[1] = swap32 (w0[1]);
+ w0_t[2] = swap32 (w0[2]);
+ w0_t[3] = swap32 (w0[3]);
+ w1_t[0] = swap32 (w1[0]);
+ w1_t[1] = swap32 (w1[1]);
+ w1_t[2] = swap32 (w1[2]);
+ w1_t[3] = swap32 (w1[3]);
+ w2_t[0] = swap32 (w2[0]);
+ w2_t[1] = swap32 (w2[1]);
+ w2_t[2] = swap32 (w2[2]);
+ w2_t[3] = swap32 (w2[3]);
+ w3_t[0] = swap32 (w3[0]);
+ w3_t[1] = swap32 (w3[1]);
+ w3_t[2] = 0;
+ w3_t[3] = pw_len * 8;
+
+ u64x digest[8];
+
+ digest[0] = SHA512M_A;
+ digest[1] = SHA512M_B;
+ digest[2] = SHA512M_C;
+ digest[3] = SHA512M_D;
+ digest[4] = SHA512M_E;
+ digest[5] = SHA512M_F;
+ digest[6] = SHA512M_G;
+ digest[7] = SHA512M_H;
+
+ sha512_transform (w0_t, w1_t, w2_t, w3_t, digest);
+
+ digest[0] += SHA512M_A;
+ digest[1] += SHA512M_B;
+ digest[2] += SHA512M_C;
+ digest[3] += SHA512M_D;
+ digest[4] += SHA512M_E;
+ digest[5] += SHA512M_F;
+ digest[6] += SHA512M_G;
+ digest[7] += SHA512M_H;
+
+ /**
+ * sha1
+ */
+
+ w0[0] = h32_from_64 (digest[0]);
+ w0[1] = l32_from_64 (digest[0]);
+ w0[2] = h32_from_64 (digest[1]);
+ w0[3] = l32_from_64 (digest[1]);
+ w1[0] = h32_from_64 (digest[2]);
+ w1[1] = l32_from_64 (digest[2]);
+ w1[2] = h32_from_64 (digest[3]);
+ w1[3] = l32_from_64 (digest[3]);
+ w2[0] = h32_from_64 (digest[4]);
+ w2[1] = l32_from_64 (digest[4]);
+ w2[2] = h32_from_64 (digest[5]);
+ w2[3] = l32_from_64 (digest[5]);
+ w3[0] = h32_from_64 (digest[6]);
+ w3[1] = l32_from_64 (digest[6]);
+ w3[2] = h32_from_64 (digest[7]);
+ w3[3] = l32_from_64 (digest[7]);
+
+ w0_t[0] = uint_to_hex_lower8_le ((w0[0] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w0[0] >> 24) & 255) << 16;
+ w0_t[1] = uint_to_hex_lower8_le ((w0[0] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w0[0] >> 8) & 255) << 16;
+ w0_t[2] = uint_to_hex_lower8_le ((w0[1] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w0[1] >> 24) & 255) << 16;
+ w0_t[3] = uint_to_hex_lower8_le ((w0[1] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w0[1] >> 8) & 255) << 16;
+ w1_t[0] = uint_to_hex_lower8_le ((w0[2] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w0[2] >> 24) & 255) << 16;
+ w1_t[1] = uint_to_hex_lower8_le ((w0[2] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w0[2] >> 8) & 255) << 16;
+ w1_t[2] = uint_to_hex_lower8_le ((w0[3] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w0[3] >> 24) & 255) << 16;
+ w1_t[3] = uint_to_hex_lower8_le ((w0[3] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w0[3] >> 8) & 255) << 16;
+ w2_t[0] = uint_to_hex_lower8_le ((w1[0] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w1[0] >> 24) & 255) << 16;
+ w2_t[1] = uint_to_hex_lower8_le ((w1[0] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w1[0] >> 8) & 255) << 16;
+ w2_t[2] = uint_to_hex_lower8_le ((w1[1] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w1[1] >> 24) & 255) << 16;
+ w2_t[3] = uint_to_hex_lower8_le ((w1[1] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w1[1] >> 8) & 255) << 16;
+ w3_t[0] = uint_to_hex_lower8_le ((w1[2] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w1[2] >> 24) & 255) << 16;
+ w3_t[1] = uint_to_hex_lower8_le ((w1[2] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w1[2] >> 8) & 255) << 16;
+ w3_t[2] = uint_to_hex_lower8_le ((w1[3] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w1[3] >> 24) & 255) << 16;
+ w3_t[3] = uint_to_hex_lower8_le ((w1[3] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w1[3] >> 8) & 255) << 16;
+
+ u32x dgst[5];
+
+ dgst[0] = SHA1M_A;
+ dgst[1] = SHA1M_B;
+ dgst[2] = SHA1M_C;
+ dgst[3] = SHA1M_D;
+ dgst[4] = SHA1M_E;
+
+ sha1_transform_vector (w0_t, w1_t, w2_t, w3_t, dgst);
+
+ w0_t[0] = uint_to_hex_lower8_le ((w2[0] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w2[0] >> 24) & 255) << 16;
+ w0_t[1] = uint_to_hex_lower8_le ((w2[0] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w2[0] >> 8) & 255) << 16;
+ w0_t[2] = uint_to_hex_lower8_le ((w2[1] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w2[1] >> 24) & 255) << 16;
+ w0_t[3] = uint_to_hex_lower8_le ((w2[1] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w2[1] >> 8) & 255) << 16;
+ w1_t[0] = uint_to_hex_lower8_le ((w2[2] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w2[2] >> 24) & 255) << 16;
+ w1_t[1] = uint_to_hex_lower8_le ((w2[2] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w2[2] >> 8) & 255) << 16;
+ w1_t[2] = uint_to_hex_lower8_le ((w2[3] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w2[3] >> 24) & 255) << 16;
+ w1_t[3] = uint_to_hex_lower8_le ((w2[3] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w2[3] >> 8) & 255) << 16;
+ w2_t[0] = uint_to_hex_lower8_le ((w3[0] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w3[0] >> 24) & 255) << 16;
+ w2_t[1] = uint_to_hex_lower8_le ((w3[0] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w3[0] >> 8) & 255) << 16;
+ w2_t[2] = uint_to_hex_lower8_le ((w3[1] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w3[1] >> 24) & 255) << 16;
+ w2_t[3] = uint_to_hex_lower8_le ((w3[1] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w3[1] >> 8) & 255) << 16;
+ w3_t[0] = uint_to_hex_lower8_le ((w3[2] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w3[2] >> 24) & 255) << 16;
+ w3_t[1] = uint_to_hex_lower8_le ((w3[2] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w3[2] >> 8) & 255) << 16;
+ w3_t[2] = uint_to_hex_lower8_le ((w3[3] >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((w3[3] >> 24) & 255) << 16;
+ w3_t[3] = uint_to_hex_lower8_le ((w3[3] >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((w3[3] >> 8) & 255) << 16;
+
+ sha1_transform_vector (w0_t, w1_t, w2_t, w3_t, dgst);
+
+ w0_t[0] = 0x80000000;
+ w0_t[1] = 0;
+ w0_t[2] = 0;
+ w0_t[3] = 0;
+ w1_t[0] = 0;
+ w1_t[1] = 0;
+ w1_t[2] = 0;
+ w1_t[3] = 0;
+ w2_t[0] = 0;
+ w2_t[1] = 0;
+ w2_t[2] = 0;
+ w2_t[3] = 0;
+ w3_t[0] = 0;
+ w3_t[1] = 0;
+ w3_t[2] = 0;
+ w3_t[3] = 128 * 8;
+
+ sha1_transform_vector (w0_t, w1_t, w2_t, w3_t, dgst);
+
+ const u32x r0 = dgst[3];
+ const u32x r1 = dgst[4];
+ const u32x r2 = dgst[2];
+ const u32x r3 = dgst[1];
+
+ COMPARE_M_SIMD (r0, r1, r2, r3);
+ }
+}
+
+__kernel void m20000_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)
+{
+}
+
+__kernel void m20000_m16 (__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)
+{
+}
+
+__kernel void m20000_s04 (__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)
+{
+ /**
+ * modifier
+ */
+
+ const u64 lid = get_local_id (0);
+
+ /**
+ * base
+ */
+
+ const u64 gid = get_global_id (0);
+
+ if (gid >= gid_max) return;
+
+ u32 pw_buf0[4];
+ u32 pw_buf1[4];
+
+ pw_buf0[0] = pws[gid].i[0];
+ pw_buf0[1] = pws[gid].i[1];
+ pw_buf0[2] = pws[gid].i[2];
+ pw_buf0[3] = pws[gid].i[3];
+ pw_buf1[0] = pws[gid].i[4];
+ pw_buf1[1] = pws[gid].i[5];
+ pw_buf1[2] = pws[gid].i[6];
+ pw_buf1[3] = pws[gid].i[7];
+
+ const u32 pw_l_len = pws[gid].pw_len;
+
+ /**
+ * digest
+ */
+
+ const u32 search[4] =
+ {
+ digests_buf[digests_offset].digest_buf[DGST_R0],
+ digests_buf[digests_offset].digest_buf[DGST_R1],
+ digests_buf[digests_offset].digest_buf[DGST_R2],
+ digests_buf[digests_offset].digest_buf[DGST_R3]
+ };
+
+ /**
+ * loop
+ */
+
+ for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
+ {
+ const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
+
+ const u32x pw_len = pw_l_len + pw_r_len;
+
+ /**
+ * concat password candidate
+ */
+
+ u32x wordl0[4] = { 0 };
+ u32x wordl1[4] = { 0 };
+ u32x wordl2[4] = { 0 };
+ u32x wordl3[4] = { 0 };
+
+ wordl0[0] = pw_buf0[0];
+ wordl0[1] = pw_buf0[1];
+ wordl0[2] = pw_buf0[2];
+ wordl0[3] = pw_buf0[3];
+ wordl1[0] = pw_buf1[0];
+ wordl1[1] = pw_buf1[1];
+ wordl1[2] = pw_buf1[2];
+ wordl1[3] = pw_buf1[3];
+
+ u32x wordr0[4] = { 0 };
+ u32x wordr1[4] = { 0 };
+ u32x wordr2[4] = { 0 };
+ u32x wordr3[4] = { 0 };
+
+ wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
+ wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
+ wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
+ wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
+ wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
+ wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
+ wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
+ wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
+
+ if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
+ {
+ switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
+ }
+ else
+ {
+ switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
+ }
+
+ u32x w0[4];
+ u32x w1[4];
+ u32x w2[4];
+ u32x w3[4];
+
+ w0[0] = wordl0[0] | wordr0[0];
+ w0[1] = wordl0[1] | wordr0[1];
+ w0[2] = wordl0[2] | wordr0[2];
+ w0[3] = wordl0[3] | wordr0[3];
+ w1[0] = wordl1[0] | wordr1[0];
+ w1[1] = wordl1[1] | wordr1[1];
+ w1[2] = wordl1[2] | wordr1[2];
+ w1[3] = wordl1[3] | wordr1[3];
+ w2[0] = wordl2[0] | wordr2[0];
+ w2[1] = wordl2[1] | wordr2[1];
+ w2[2] = wordl2[2] | wordr2[2];
+ w2[3] = wordl2[3] | wordr2[3];
+ w3[0] = wordl3[0] | wordr3[0];
+ w3[1] = wordl3[1] | wordr3[1];
+ w3[2] = wordl3[2] | wordr3[2];
+ w3[3] = wordl3[3] | wordr3[3];
+
+ /**
+ * sha512
+ */
+
+ u32x w0_t[4];
+ u32x w1_t[4];
+ u32x w2_t[4];
+ u32x w3_t[4];
+
+ w0_t[0] = swap32 (w0[0]);
+ w0_t[1] = swap32 (w0[1]);
+ w0_t[2] = swap32 (w0[2]);
+ w0_t[3] = swap32 (w0[3]);
+ w1_t[0] = swap32 (w1[0]);
+ w1_t[1] = swap32 (w1[1]);
+ w1_t[2] = swap32 (w1[2]);
+ w1_t[3] = swap32 (w1[3]);
+ w2_t[0] = swap32 (w2[0]);
+ w2_t[1] = swap32 (w2[1]);
+ w2_t[2] = swap32 (w2[2]);
+ w2_t[3] = swap32 (w2[3]);
+ w3_t[0] = swap32 (w3[0]);
+ w3_t[1] = swap32 (w3[1]);
+ w3_t[2] = 0;
+ w3_t[3] = pw_len * 8;
+
+ u64x digest[8];
+
+ digest[0] = SHA512M_A;
+ digest[1] = SHA512M_B;
+ digest[2] = SHA512M_C;
+ digest[3] = SHA512M_D;
+ digest[4] = SHA512M_E;
+ digest[5] = SHA512M_F;
+ digest[6] = SHA512M_G;
+ digest[7] = SHA512M_H;
+
+ sha512_transform (w0_t, w1_t, w2_t, w3_t, digest);
+
+ const u32x r0 = l32_from_64 (digest[7]);
+ const u32x r1 = h32_from_64 (digest[7]);
+ const u32x r2 = l32_from_64 (digest[3]);
+ const u32x r3 = h32_from_64 (digest[3]);
+
+ COMPARE_S_SIMD (r0, r1, r2, r3);
+ }
+}
+
+__kernel void m20000_s08 (__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)
+{
+}
+
+__kernel void m20000_s16 (__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)
+{
+}
diff --git a/OpenCL/m20000_a1.cl b/OpenCL/m20000_a1.cl
new file mode 100644
index 00000000..6354f1b2
--- /dev/null
+++ b/OpenCL/m20000_a1.cl
@@ -0,0 +1,251 @@
+/**
+ * Author......: See docs/credits.txt
+ * License.....: MIT
+ */
+
+//#define NEW_SIMD_CODE
+
+#include "inc_vendor.cl"
+#include "inc_hash_constants.h"
+#include "inc_hash_functions.cl"
+#include "inc_types.cl"
+#include "inc_common.cl"
+#include "inc_scalar.cl"
+#include "inc_hash_sha1.cl"
+#include "inc_hash_sha512.cl"
+
+#if VECT_SIZE == 1
+#define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i)])
+#elif VECT_SIZE == 2
+#define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
+#elif VECT_SIZE == 4
+#define uint_to_hex_lower8_le(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
+#elif VECT_SIZE == 8
+#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])
+#elif VECT_SIZE == 16
+#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])
+#endif
+
+__kernel void m20000_mxx (__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)
+{
+ /**
+ * modifier
+ */
+
+ const u64 lid = get_local_id (0);
+ const u64 gid = get_global_id (0);
+ const u64 lsz = get_local_size (0);
+
+ /**
+ * bin2asc table
+ */
+
+ __local u32 l_bin2asc[256];
+
+ for (u32 i = lid; i < 256; i += lsz)
+ {
+ const u32 i0 = (i >> 0) & 15;
+ const u32 i1 = (i >> 4) & 15;
+
+ l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 0
+ | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 8;
+ }
+
+ barrier (CLK_LOCAL_MEM_FENCE);
+
+ if (gid >= gid_max) return;
+
+ /**
+ * base
+ */
+
+ sha512_ctx_t ctx0;
+
+ sha512_init (&ctx0);
+
+ sha512_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
+
+ /**
+ * loop
+ */
+
+ for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
+ {
+ sha512_ctx_t ctx1 = ctx0;
+
+ sha512_update_global_swap (&ctx1, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
+
+ sha512_final (&ctx1);
+
+ const u32 ah = h32_from_64_S (ctx1.h[0]);
+ const u32 al = l32_from_64_S (ctx1.h[0]);
+ const u32 bh = h32_from_64_S (ctx1.h[1]);
+ const u32 bl = l32_from_64_S (ctx1.h[1]);
+ const u32 ch = h32_from_64_S (ctx1.h[2]);
+ const u32 cl = l32_from_64_S (ctx1.h[2]);
+ const u32 dh = h32_from_64_S (ctx1.h[3]);
+ const u32 dl = l32_from_64_S (ctx1.h[3]);
+ const u32 eh = h32_from_64_S (ctx1.h[4]);
+ const u32 el = l32_from_64_S (ctx1.h[4]);
+ const u32 fh = h32_from_64_S (ctx1.h[5]);
+ const u32 fl = l32_from_64_S (ctx1.h[5]);
+ const u32 gh = h32_from_64_S (ctx1.h[6]);
+ const u32 gl = l32_from_64_S (ctx1.h[6]);
+ const u32 hh = h32_from_64_S (ctx1.h[7]);
+ const u32 hl = l32_from_64_S (ctx1.h[7]);
+
+ sha1_ctx_t ctx;
+
+ sha1_init (&ctx);
+
+ ctx.w0[0] = uint_to_hex_lower8_le ((ah >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((ah >> 24) & 255) << 16;
+ ctx.w0[1] = uint_to_hex_lower8_le ((ah >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((ah >> 8) & 255) << 16;
+ ctx.w0[2] = uint_to_hex_lower8_le ((al >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((al >> 24) & 255) << 16;
+ ctx.w0[3] = uint_to_hex_lower8_le ((al >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((al >> 8) & 255) << 16;
+ ctx.w1[0] = uint_to_hex_lower8_le ((bh >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((bh >> 24) & 255) << 16;
+ ctx.w1[1] = uint_to_hex_lower8_le ((bh >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((bh >> 8) & 255) << 16;
+ ctx.w1[2] = uint_to_hex_lower8_le ((bl >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((bl >> 24) & 255) << 16;
+ ctx.w1[3] = uint_to_hex_lower8_le ((bl >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((bl >> 8) & 255) << 16;
+ ctx.w2[0] = uint_to_hex_lower8_le ((ch >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((ch >> 24) & 255) << 16;
+ ctx.w2[1] = uint_to_hex_lower8_le ((ch >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((ch >> 8) & 255) << 16;
+ ctx.w2[2] = uint_to_hex_lower8_le ((cl >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((cl >> 24) & 255) << 16;
+ ctx.w2[3] = uint_to_hex_lower8_le ((cl >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((cl >> 8) & 255) << 16;
+ ctx.w3[0] = uint_to_hex_lower8_le ((dh >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((dh >> 24) & 255) << 16;
+ ctx.w3[1] = uint_to_hex_lower8_le ((dh >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((dh >> 8) & 255) << 16;
+ ctx.w3[2] = uint_to_hex_lower8_le ((dl >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((dl >> 24) & 255) << 16;
+ ctx.w3[3] = uint_to_hex_lower8_le ((dl >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((dl >> 8) & 255) << 16;
+
+ sha1_transform (ctx.w0, ctx.w1, ctx.w2, ctx.w3, ctx.h);
+
+ ctx.w0[0] = uint_to_hex_lower8_le ((eh >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((eh >> 24) & 255) << 16;
+ ctx.w0[1] = uint_to_hex_lower8_le ((eh >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((eh >> 8) & 255) << 16;
+ ctx.w0[2] = uint_to_hex_lower8_le ((el >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((el >> 24) & 255) << 16;
+ ctx.w0[3] = uint_to_hex_lower8_le ((el >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((el >> 8) & 255) << 16;
+ ctx.w1[0] = uint_to_hex_lower8_le ((fh >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((fh >> 24) & 255) << 16;
+ ctx.w1[1] = uint_to_hex_lower8_le ((fh >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((fh >> 8) & 255) << 16;
+ ctx.w1[2] = uint_to_hex_lower8_le ((fl >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((fl >> 24) & 255) << 16;
+ ctx.w1[3] = uint_to_hex_lower8_le ((fl >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((fl >> 8) & 255) << 16;
+ ctx.w2[0] = uint_to_hex_lower8_le ((gh >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((gh >> 24) & 255) << 16;
+ ctx.w2[1] = uint_to_hex_lower8_le ((gh >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((gh >> 8) & 255) << 16;
+ ctx.w2[2] = uint_to_hex_lower8_le ((gl >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((gl >> 24) & 255) << 16;
+ ctx.w2[3] = uint_to_hex_lower8_le ((gl >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((gl >> 8) & 255) << 16;
+ ctx.w3[0] = uint_to_hex_lower8_le ((hh >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((hh >> 24) & 255) << 16;
+ ctx.w3[1] = uint_to_hex_lower8_le ((hh >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((hh >> 8) & 255) << 16;
+ ctx.w3[2] = uint_to_hex_lower8_le ((hl >> 16) & 255) << 0
+ | uint_to_hex_lower8_le ((hl >> 24) & 255) << 16;
+ ctx.w3[3] = uint_to_hex_lower8_le ((hl >> 0) & 255) << 0
+ | uint_to_hex_lower8_le ((hl >> 8) & 255) << 16;
+
+ sha1_transform (ctx.w0, ctx.w1, ctx.w2, ctx.w3, ctx.h);
+
+ ctx.w0[0] = 0x80000000;
+ ctx.w0[1] = 0;
+ ctx.w0[2] = 0;
+ ctx.w0[3] = 0;
+ ctx.w1[0] = 0;
+ ctx.w1[1] = 0;
+ ctx.w1[2] = 0;
+ ctx.w1[3] = 0;
+ ctx.w2[0] = 0;
+ ctx.w2[1] = 0;
+ ctx.w2[2] = 0;
+ ctx.w2[3] = 0;
+ ctx.w3[0] = 0;
+ ctx.w3[1] = 0;
+ ctx.w3[2] = 0;
+ ctx.w3[3] = 128 * 8;
+
+ sha1_transform (ctx.w0, ctx.w1, ctx.w2, ctx.w3, ctx.h);
+
+ const u32 r0 = ctx.h[DGST_R0];
+ const u32 r1 = ctx.h[DGST_R1];
+ const u32 r2 = ctx.h[DGST_R2];
+ const u32 r3 = ctx.h[DGST_R3];
+
+ COMPARE_M_SCALAR (r0, r1, r2, r3);
+ }
+}
+
+__kernel void m20000_sxx (__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)
+{
+ /**
+ * modifier
+ */
+
+ const u64 lid = get_local_id (0);
+ const u64 gid = get_global_id (0);
+
+ if (gid >= gid_max) return;
+
+ /**
+ * digest
+ */
+
+ const u32 search[4] =
+ {
+ digests_buf[digests_offset].digest_buf[DGST_R0],
+ digests_buf[digests_offset].digest_buf[DGST_R1],
+ digests_buf[digests_offset].digest_buf[DGST_R2],
+ digests_buf[digests_offset].digest_buf[DGST_R3]
+ };
+
+ /**
+ * base
+ */
+
+ sha512_ctx_t ctx0;
+
+ sha512_init (&ctx0);
+
+ sha512_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
+
+ /**
+ * loop
+ */
+
+ for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
+ {
+ sha512_ctx_t ctx = ctx0;
+
+ sha512_update_global_swap (&ctx, combs_buf[il_pos].i, combs_buf[il_pos].pw_len);
+
+ sha512_final (&ctx);
+
+ const u32 r0 = l32_from_64_S (ctx.h[7]);
+ const u32 r1 = h32_from_64_S (ctx.h[7]);
+ const u32 r2 = l32_from_64_S (ctx.h[3]);
+ const u32 r3 = h32_from_64_S (ctx.h[3]);
+
+ COMPARE_S_SCALAR (r0, r1, r2, r3);
+ }
+}
diff --git a/include/interface.h b/include/interface.h
index ed91ea89..c9f03aa0 100644
--- a/include/interface.h
+++ b/include/interface.h
@@ -1610,6 +1610,7 @@ typedef enum kern_type
KERN_TYPE_ETHEREUM_PBKDF2 = 15600,
KERN_TYPE_ETHEREUM_SCRYPT = 15700,
KERN_TYPE_WPAAES = 15800,
+ KERN_TYPE_SHA1SHA512 = 20000,
KERN_TYPE_PLAINTEXT = 99999,
} kern_type_t;
diff --git a/src/interface.c b/src/interface.c
index 7d02607e..dac02b05 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -266,6 +266,7 @@ static char ST_HASH_15500[] = "$jksprivk$*338BD2FBEBA7B3EF198A4CBFC6E18AFF1E2293
static char ST_HASH_15600[] = "$ethereum$p*1024*38353131353831333338313138363430*a8b4dfe92687dbc0afeb5dae7863f18964241e96b264f09959903c8c924583fc*0a9252861d1e235994ce33dbca91c98231764d8ecb4950015a8ae20d6415b986";
static char ST_HASH_15700[] = "$ethereum$s*1024*1*1*3033363133373132373638333437323331383637383437333631373038323434*69eaf081695cf971ef7ee5a49997c1a3922e7efef59068109e83853755ee31c3*64a1adec1750ee4416b22b81111dd2a3c2fede820d6da8bf788dca2641d5b181";
static char ST_HASH_15800[] = "484350580400000000054e65686562000000000000000000000000000000000000000000000000000000032e13c40ca1c2e4e2037f99a2da18a46bb0b98a568dea0218c7b64ecef40c4f15915fbceb19c8d62608387eb6b986d9599a8bd70dc85d2cf0a2ddbcd06467233e730767c33e1df875c3ad0eb58a51ad704a3fae06b818c0c5fcebf3af79000203007502010b001000000000000000036467233e730767c33e1df875c3ad0eb58a51ad704a3fae06b818c0c5fcebf3af000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001630140100000fac040100000fac040100000fac068c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
+static char ST_HASH_20000[] = "c3f30e0bbd8f65fdc8b5af2642066ceac5b75e34";
static char ST_HASH_99999[] = "hashcat";
static const char OPTI_STR_OPTIMIZED_KERNEL[] = "Optimized-Kernel";
@@ -498,6 +499,7 @@ static const char HT_15500[] = "JKS Java Key Store Private Keys (SHA1)";
static const char HT_15600[] = "Ethereum Wallet, PBKDF2-HMAC-SHA256";
static const char HT_15700[] = "Ethereum Wallet, SCRYPT";
static const char HT_15800[] = "WPA/WPA2 AES-CMAC";
+static const char HT_20000[] = "sha1(sha512($pass))";
static const char HT_99999[] = "Plaintext";
static const char HT_00011[] = "Joomla < 2.5.18";
@@ -16039,6 +16041,7 @@ char *strhashtype (const u32 hash_mode)
case 15600: return ((char *) HT_15600);
case 15700: return ((char *) HT_15700);
case 15800: return ((char *) HT_15800);
+ case 20000: return ((char *) HT_20000);
case 99999: return ((char *) HT_99999);
}
@@ -24286,6 +24289,29 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->st_pass = ST_PASS_BOSSPW_PLAIN;
break;
+ case 20000: hashconfig->hash_type = HASH_TYPE_SHA1;
+ hashconfig->salt_type = SALT_TYPE_NONE;
+ hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
+ hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_BE
+ | OPTS_TYPE_PT_ADD80
+ | OPTS_TYPE_PT_ADDBITS15;
+ hashconfig->kern_type = KERN_TYPE_SHA1SHA512;
+ hashconfig->dgst_size = DGST_SIZE_4_5;
+ hashconfig->parse_func = sha1_parse_hash;
+ hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
+ | OPTI_TYPE_PRECOMPUTE_INIT
+ | OPTI_TYPE_EARLY_SKIP
+ | OPTI_TYPE_NOT_ITERATED
+ | OPTI_TYPE_NOT_SALTED
+ | OPTI_TYPE_RAW_HASH;
+ hashconfig->dgst_pos0 = 3;
+ hashconfig->dgst_pos1 = 4;
+ hashconfig->dgst_pos2 = 2;
+ hashconfig->dgst_pos3 = 1;
+ hashconfig->st_hash = ST_HASH_20000;
+ hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
+ break;
+
case 99999: hashconfig->hash_type = HASH_TYPE_PLAINTEXT;
hashconfig->salt_type = SALT_TYPE_NONE;
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
diff --git a/src/usage.c b/src/usage.c
index 5fc35b3a..12bbe3e9 100644
--- a/src/usage.c
+++ b/src/usage.c
@@ -158,6 +158,7 @@ static const char *USAGE_BIG[] =
" 4520 | sha1($salt.sha1($pass)) | Raw Hash, Salted and/or Iterated",
" 4700 | sha1(md5($pass)) | Raw Hash, Salted and/or Iterated",
" 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and/or Iterated",
+ " 20000 | sha1(sha512($pass)) | Raw Hash, Salted and/or Iterated",
" 14400 | sha1(CX) | Raw Hash, Salted and/or Iterated",
" 1410 | sha256($pass.$salt) | Raw Hash, Salted and/or Iterated",
" 1420 | sha256($salt.$pass) | Raw Hash, Salted and/or Iterated",
--
2.14.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment