mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-25 01:18:15 +00:00
Add VeraCrypt Streebog support
VeraCrypt added the possibility to use Streebog-512 as hashing algorithm for the key derivation. This commit adds the necessary VeraCrypt kernels as well as additional HMAC-Streebog kernels. - Add hash-mode 13771: VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 512 bit - Add hash-mode 13772: VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1024 bit - Add hash-mode 13773: VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1536 bit - Add hash-mode 11750: HMAC-Streebog-256 (key = $pass), big-endian - Add hash-mode 11760: HMAC-Streebog-256 (key = $salt), big-endian - Add hash-mode 11860: HMAC-Streebog-512 (key = $salt), big-endian - Add test suite for hash-modes 11750, 11760 and 11860 - Improve pure Streebog kernels
This commit is contained in:
parent
e1011c51a3
commit
47bd838e25
@ -608,14 +608,14 @@ __constant u64a sbob_rc64[12][8] =
|
||||
#endif
|
||||
|
||||
#define SBOG_LPSti64 \
|
||||
BOX (sbob_sl64, 0, ((t[0] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 1, ((t[1] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 2, ((t[2] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 3, ((t[3] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 4, ((t[4] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 5, ((t[5] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 6, ((t[6] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 7, ((t[7] >> (i * 8)) & 0xff))
|
||||
BOX (s_sbob_sl64, 0, ((t[0] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 1, ((t[1] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 2, ((t[2] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 3, ((t[3] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 4, ((t[4] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 5, ((t[5] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 6, ((t[6] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 7, ((t[7] >> (i * 8)) & 0xff))
|
||||
|
||||
typedef struct streebog256_ctx
|
||||
{
|
||||
@ -630,9 +630,11 @@ typedef struct streebog256_ctx
|
||||
|
||||
int len;
|
||||
|
||||
SHM_TYPE u64a (*s_sbob_sl64)[256];
|
||||
|
||||
} streebog256_ctx_t;
|
||||
|
||||
DECLSPEC void streebog256_init (streebog256_ctx_t *ctx)
|
||||
DECLSPEC void streebog256_init (streebog256_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
ctx->h[0] = 0x0101010101010101;
|
||||
ctx->h[1] = 0x0101010101010101;
|
||||
@ -682,11 +684,13 @@ DECLSPEC void streebog256_init (streebog256_ctx_t *ctx)
|
||||
ctx->w3[3] = 0;
|
||||
|
||||
ctx->len = 0;
|
||||
|
||||
ctx->s_sbob_sl64 = s_sbob_sl64;
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_add (u64 *x, const u64 *y)
|
||||
{
|
||||
u32 carry = 0;
|
||||
u64 carry = 0;
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -697,13 +701,13 @@ DECLSPEC void streebog256_add (u64 *x, const u64 *y)
|
||||
const u64 right = swap64_S (y[i]);
|
||||
const u64 sum = left + right + carry;
|
||||
|
||||
carry = (sum < left) ? 1 : 0;
|
||||
carry = (sum < left) ? (u64) 1 : (u64) 0;
|
||||
|
||||
x[i] = swap64_S (sum);
|
||||
}
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_g (u64 *h, const u64 *n, const u64 *m)
|
||||
DECLSPEC void streebog256_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u64 k[8];
|
||||
u64 s[8];
|
||||
@ -784,7 +788,7 @@ DECLSPEC void streebog256_transform (streebog256_ctx_t *ctx, const u32 *w0, cons
|
||||
m[6] = hl32_to_64_S (w0[2], w0[3]);
|
||||
m[7] = hl32_to_64_S (w0[0], w0[1]);
|
||||
|
||||
streebog256_g (ctx->h, ctx->n, m);
|
||||
streebog256_g (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
|
||||
|
||||
u64 counterbuf[8] = { 0 };
|
||||
counterbuf[7] = swap64_S ((u64) 0x200);
|
||||
@ -869,6 +873,63 @@ DECLSPEC void streebog256_update_64 (streebog256_ctx_t *ctx, u32 *w0, u32 *w1, u
|
||||
}
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_update (streebog256_ctx_t *ctx, const u32 *w, int len)
|
||||
{
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
|
||||
int off = 0;
|
||||
|
||||
while (len > 63)
|
||||
{
|
||||
w0[0] = w[off + 0];
|
||||
w0[1] = w[off + 1];
|
||||
w0[2] = w[off + 2];
|
||||
w0[3] = w[off + 3];
|
||||
w1[0] = w[off + 4];
|
||||
w1[1] = w[off + 5];
|
||||
w1[2] = w[off + 6];
|
||||
w1[3] = w[off + 7];
|
||||
w2[0] = w[off + 8];
|
||||
w2[1] = w[off + 9];
|
||||
w2[2] = w[off + 10];
|
||||
w2[3] = w[off + 11];
|
||||
w3[0] = w[off + 12];
|
||||
w3[1] = w[off + 13];
|
||||
w3[2] = w[off + 14];
|
||||
w3[3] = w[off + 15];
|
||||
|
||||
off += 16;
|
||||
len -= 64;
|
||||
|
||||
streebog256_update_64 (ctx, w0, w1, w2, w3, 64);
|
||||
}
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
w0[0] = w[off + 0];
|
||||
w0[1] = w[off + 1];
|
||||
w0[2] = w[off + 2];
|
||||
w0[3] = w[off + 3];
|
||||
w1[0] = w[off + 4];
|
||||
w1[1] = w[off + 5];
|
||||
w1[2] = w[off + 6];
|
||||
w1[3] = w[off + 7];
|
||||
w2[0] = w[off + 8];
|
||||
w2[1] = w[off + 9];
|
||||
w2[2] = w[off + 10];
|
||||
w2[3] = w[off + 11];
|
||||
w3[0] = w[off + 12];
|
||||
w3[1] = w[off + 13];
|
||||
w3[2] = w[off + 14];
|
||||
w3[3] = w[off + 15];
|
||||
|
||||
streebog256_update_64 (ctx, w0, w1, w2, w3, len);
|
||||
}
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_update_swap (streebog256_ctx_t *ctx, const u32 *w, int len)
|
||||
{
|
||||
u32 w0[4];
|
||||
@ -1000,7 +1061,7 @@ DECLSPEC void streebog256_final (streebog256_ctx_t *ctx)
|
||||
m[6] = hl32_to_64_S (ctx->w0[2], ctx->w0[3]);
|
||||
m[7] = hl32_to_64_S (ctx->w0[0], ctx->w0[1]);
|
||||
|
||||
streebog256_g (ctx->h, ctx->n, m);
|
||||
streebog256_g (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
|
||||
|
||||
u64 sizebuf[8] = { 0 };
|
||||
sizebuf[7] = swap64_S ((u64) (ctx->len << 3));
|
||||
@ -1011,9 +1072,235 @@ DECLSPEC void streebog256_final (streebog256_ctx_t *ctx)
|
||||
|
||||
const u64 nullbuf[8] = { 0 };
|
||||
|
||||
streebog256_g (ctx->h, nullbuf, ctx->n);
|
||||
streebog256_g (ctx->h, nullbuf, ctx->n, ctx->s_sbob_sl64);
|
||||
|
||||
streebog256_g (ctx->h, nullbuf, ctx->s);
|
||||
streebog256_g (ctx->h, nullbuf, ctx->s, ctx->s_sbob_sl64);
|
||||
}
|
||||
|
||||
typedef struct streebog256_hmac_ctx
|
||||
{
|
||||
streebog256_ctx_t ipad;
|
||||
streebog256_ctx_t opad;
|
||||
|
||||
} streebog256_hmac_ctx_t;
|
||||
|
||||
DECLSPEC void streebog256_hmac_init_64 (streebog256_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32 t0[4];
|
||||
u32 t1[4];
|
||||
u32 t2[4];
|
||||
u32 t3[4];
|
||||
|
||||
// ipad
|
||||
|
||||
t0[0] = w0[0] ^ 0x36363636;
|
||||
t0[1] = w0[1] ^ 0x36363636;
|
||||
t0[2] = w0[2] ^ 0x36363636;
|
||||
t0[3] = w0[3] ^ 0x36363636;
|
||||
t1[0] = w1[0] ^ 0x36363636;
|
||||
t1[1] = w1[1] ^ 0x36363636;
|
||||
t1[2] = w1[2] ^ 0x36363636;
|
||||
t1[3] = w1[3] ^ 0x36363636;
|
||||
t2[0] = w2[0] ^ 0x36363636;
|
||||
t2[1] = w2[1] ^ 0x36363636;
|
||||
t2[2] = w2[2] ^ 0x36363636;
|
||||
t2[3] = w2[3] ^ 0x36363636;
|
||||
t3[0] = w3[0] ^ 0x36363636;
|
||||
t3[1] = w3[1] ^ 0x36363636;
|
||||
t3[2] = w3[2] ^ 0x36363636;
|
||||
t3[3] = w3[3] ^ 0x36363636;
|
||||
|
||||
streebog256_init (&ctx->ipad, s_sbob_sl64);
|
||||
|
||||
streebog256_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
|
||||
|
||||
// opad
|
||||
|
||||
t0[0] = w0[0] ^ 0x5c5c5c5c;
|
||||
t0[1] = w0[1] ^ 0x5c5c5c5c;
|
||||
t0[2] = w0[2] ^ 0x5c5c5c5c;
|
||||
t0[3] = w0[3] ^ 0x5c5c5c5c;
|
||||
t1[0] = w1[0] ^ 0x5c5c5c5c;
|
||||
t1[1] = w1[1] ^ 0x5c5c5c5c;
|
||||
t1[2] = w1[2] ^ 0x5c5c5c5c;
|
||||
t1[3] = w1[3] ^ 0x5c5c5c5c;
|
||||
t2[0] = w2[0] ^ 0x5c5c5c5c;
|
||||
t2[1] = w2[1] ^ 0x5c5c5c5c;
|
||||
t2[2] = w2[2] ^ 0x5c5c5c5c;
|
||||
t2[3] = w2[3] ^ 0x5c5c5c5c;
|
||||
t3[0] = w3[0] ^ 0x5c5c5c5c;
|
||||
t3[1] = w3[1] ^ 0x5c5c5c5c;
|
||||
t3[2] = w3[2] ^ 0x5c5c5c5c;
|
||||
t3[3] = w3[3] ^ 0x5c5c5c5c;
|
||||
|
||||
streebog256_init (&ctx->opad, s_sbob_sl64);
|
||||
|
||||
streebog256_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_init (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
|
||||
if (len > 64)
|
||||
{
|
||||
streebog256_ctx_t tmp;
|
||||
|
||||
streebog256_init (&tmp, s_sbob_sl64);
|
||||
|
||||
streebog256_update (&tmp, w, len);
|
||||
|
||||
streebog256_final (&tmp);
|
||||
|
||||
w0[0] = h32_from_64_S (tmp.h[0]);
|
||||
w0[1] = l32_from_64_S (tmp.h[0]);
|
||||
w0[2] = h32_from_64_S (tmp.h[1]);
|
||||
w0[3] = l32_from_64_S (tmp.h[1]);
|
||||
w1[0] = h32_from_64_S (tmp.h[2]);
|
||||
w1[1] = l32_from_64_S (tmp.h[2]);
|
||||
w1[2] = h32_from_64_S (tmp.h[3]);
|
||||
w1[3] = l32_from_64_S (tmp.h[3]);
|
||||
w2[0] = h32_from_64_S (tmp.h[4]);
|
||||
w2[1] = l32_from_64_S (tmp.h[4]);
|
||||
w2[2] = h32_from_64_S (tmp.h[5]);
|
||||
w2[3] = l32_from_64_S (tmp.h[5]);
|
||||
w3[0] = h32_from_64_S (tmp.h[6]);
|
||||
w3[1] = l32_from_64_S (tmp.h[6]);
|
||||
w3[2] = h32_from_64_S (tmp.h[7]);
|
||||
w3[3] = l32_from_64_S (tmp.h[7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
w0[0] = w[ 0];
|
||||
w0[1] = w[ 1];
|
||||
w0[2] = w[ 2];
|
||||
w0[3] = w[ 3];
|
||||
w1[0] = w[ 4];
|
||||
w1[1] = w[ 5];
|
||||
w1[2] = w[ 6];
|
||||
w1[3] = w[ 7];
|
||||
w2[0] = w[ 8];
|
||||
w2[1] = w[ 9];
|
||||
w2[2] = w[10];
|
||||
w2[3] = w[11];
|
||||
w3[0] = w[12];
|
||||
w3[1] = w[13];
|
||||
w3[2] = w[14];
|
||||
w3[3] = w[15];
|
||||
}
|
||||
|
||||
streebog256_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_init_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
|
||||
if (len > 64)
|
||||
{
|
||||
streebog256_ctx_t tmp;
|
||||
|
||||
streebog256_init (&tmp, s_sbob_sl64);
|
||||
|
||||
streebog256_update_swap (&tmp, w, len);
|
||||
|
||||
streebog256_final (&tmp);
|
||||
|
||||
w0[0] = h32_from_64_S (tmp.h[0]);
|
||||
w0[1] = l32_from_64_S (tmp.h[0]);
|
||||
w0[2] = h32_from_64_S (tmp.h[1]);
|
||||
w0[3] = l32_from_64_S (tmp.h[1]);
|
||||
w1[0] = h32_from_64_S (tmp.h[2]);
|
||||
w1[1] = l32_from_64_S (tmp.h[2]);
|
||||
w1[2] = h32_from_64_S (tmp.h[3]);
|
||||
w1[3] = l32_from_64_S (tmp.h[3]);
|
||||
w2[0] = h32_from_64_S (tmp.h[4]);
|
||||
w2[1] = l32_from_64_S (tmp.h[4]);
|
||||
w2[2] = h32_from_64_S (tmp.h[5]);
|
||||
w2[3] = l32_from_64_S (tmp.h[5]);
|
||||
w3[0] = h32_from_64_S (tmp.h[6]);
|
||||
w3[1] = l32_from_64_S (tmp.h[6]);
|
||||
w3[2] = h32_from_64_S (tmp.h[7]);
|
||||
w3[3] = l32_from_64_S (tmp.h[7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
w0[0] = swap32_S (w[ 0]);
|
||||
w0[1] = swap32_S (w[ 1]);
|
||||
w0[2] = swap32_S (w[ 2]);
|
||||
w0[3] = swap32_S (w[ 3]);
|
||||
w1[0] = swap32_S (w[ 4]);
|
||||
w1[1] = swap32_S (w[ 5]);
|
||||
w1[2] = swap32_S (w[ 6]);
|
||||
w1[3] = swap32_S (w[ 7]);
|
||||
w2[0] = swap32_S (w[ 8]);
|
||||
w2[1] = swap32_S (w[ 9]);
|
||||
w2[2] = swap32_S (w[10]);
|
||||
w2[3] = swap32_S (w[11]);
|
||||
w3[0] = swap32_S (w[12]);
|
||||
w3[1] = swap32_S (w[13]);
|
||||
w3[2] = swap32_S (w[14]);
|
||||
w3[3] = swap32_S (w[15]);
|
||||
}
|
||||
|
||||
streebog256_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_update_64 (streebog256_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
|
||||
{
|
||||
streebog256_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_update (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len)
|
||||
{
|
||||
streebog256_update (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_update_swap (streebog256_hmac_ctx_t *ctx, const u32 *w, const int len)
|
||||
{
|
||||
streebog256_update_swap (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_update_global_swap (streebog256_hmac_ctx_t *ctx, const __global u32 *w, const int len)
|
||||
{
|
||||
streebog256_update_global_swap (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_final (streebog256_hmac_ctx_t *ctx)
|
||||
{
|
||||
streebog256_final (&ctx->ipad);
|
||||
|
||||
u32 t0[4];
|
||||
u32 t1[4];
|
||||
u32 t2[4];
|
||||
u32 t3[4];
|
||||
|
||||
t0[0] = h32_from_64_S (ctx->ipad.h[3]);
|
||||
t0[1] = l32_from_64_S (ctx->ipad.h[3]);
|
||||
t0[2] = h32_from_64_S (ctx->ipad.h[2]);
|
||||
t0[3] = l32_from_64_S (ctx->ipad.h[2]);
|
||||
t1[0] = h32_from_64_S (ctx->ipad.h[1]);
|
||||
t1[1] = l32_from_64_S (ctx->ipad.h[1]);
|
||||
t1[2] = h32_from_64_S (ctx->ipad.h[0]);
|
||||
t1[3] = l32_from_64_S (ctx->ipad.h[0]);
|
||||
t2[0] = 0;
|
||||
t2[1] = 0;
|
||||
t2[2] = 0;
|
||||
t2[3] = 0;
|
||||
t3[0] = 0;
|
||||
t3[1] = 0;
|
||||
t3[2] = 0;
|
||||
t3[3] = 0;
|
||||
|
||||
streebog256_update_64 (&ctx->opad, t0, t1, t2, t3, 32);
|
||||
|
||||
streebog256_final (&ctx->opad);
|
||||
}
|
||||
|
||||
typedef struct streebog256_ctx_vector
|
||||
@ -1031,9 +1318,11 @@ typedef struct streebog256_ctx_vector
|
||||
|
||||
int len;
|
||||
|
||||
SHM_TYPE u64a (*s_sbob_sl64)[256];
|
||||
|
||||
} streebog256_ctx_vector_t;
|
||||
|
||||
DECLSPEC void streebog256_init_vector (streebog256_ctx_vector_t *ctx)
|
||||
DECLSPEC void streebog256_init_vector (streebog256_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
ctx->h[0] = 0x0101010101010101;
|
||||
ctx->h[1] = 0x0101010101010101;
|
||||
@ -1083,11 +1372,13 @@ DECLSPEC void streebog256_init_vector (streebog256_ctx_vector_t *ctx)
|
||||
ctx->w3[3] = 0;
|
||||
|
||||
ctx->len = 0;
|
||||
|
||||
ctx->s_sbob_sl64 = s_sbob_sl64;
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_add_vector (u64x *x, const u64x *y)
|
||||
{
|
||||
u32x carry = 0;
|
||||
u64x carry = 0;
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -1098,13 +1389,13 @@ DECLSPEC void streebog256_add_vector (u64x *x, const u64x *y)
|
||||
const u64x right = swap64 (y[i]);
|
||||
const u64x sum = left + right + carry;
|
||||
|
||||
carry = (sum < left) ? 1 : 0;
|
||||
carry = (sum < left) ? (u64x) 1 : (u64x) 0;
|
||||
|
||||
x[i] = swap64 (sum);
|
||||
}
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_g_vector (u64x *h, const u64x *n, const u64x *m)
|
||||
DECLSPEC void streebog256_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u64x k[8];
|
||||
u64x s[8];
|
||||
@ -1185,7 +1476,7 @@ DECLSPEC void streebog256_transform_vector (streebog256_ctx_vector_t *ctx, const
|
||||
m[6] = hl32_to_64 (w0[2], w0[3]);
|
||||
m[7] = hl32_to_64 (w0[0], w0[1]);
|
||||
|
||||
streebog256_g_vector (ctx->h, ctx->n, m);
|
||||
streebog256_g_vector (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
|
||||
|
||||
u64x counterbuf[8] = { 0 };
|
||||
counterbuf[7] = swap64 ((u64x) 0x200);
|
||||
@ -1270,6 +1561,63 @@ DECLSPEC void streebog256_update_vector_64 (streebog256_ctx_vector_t *ctx, u32x
|
||||
}
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_update_vector (streebog256_ctx_vector_t *ctx, const u32x *w, int len)
|
||||
{
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
int off = 0;
|
||||
|
||||
while (len > 63)
|
||||
{
|
||||
w0[0] = w[off + 0];
|
||||
w0[1] = w[off + 1];
|
||||
w0[2] = w[off + 2];
|
||||
w0[3] = w[off + 3];
|
||||
w1[0] = w[off + 4];
|
||||
w1[1] = w[off + 5];
|
||||
w1[2] = w[off + 6];
|
||||
w1[3] = w[off + 7];
|
||||
w2[0] = w[off + 8];
|
||||
w2[1] = w[off + 9];
|
||||
w2[2] = w[off + 10];
|
||||
w2[3] = w[off + 11];
|
||||
w3[0] = w[off + 12];
|
||||
w3[1] = w[off + 13];
|
||||
w3[2] = w[off + 14];
|
||||
w3[3] = w[off + 15];
|
||||
|
||||
off += 16;
|
||||
len -= 64;
|
||||
|
||||
streebog256_update_vector_64 (ctx, w0, w1, w2, w3, 64);
|
||||
}
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
w0[0] = w[off + 0];
|
||||
w0[1] = w[off + 1];
|
||||
w0[2] = w[off + 2];
|
||||
w0[3] = w[off + 3];
|
||||
w1[0] = w[off + 4];
|
||||
w1[1] = w[off + 5];
|
||||
w1[2] = w[off + 6];
|
||||
w1[3] = w[off + 7];
|
||||
w2[0] = w[off + 8];
|
||||
w2[1] = w[off + 9];
|
||||
w2[2] = w[off + 10];
|
||||
w2[3] = w[off + 11];
|
||||
w3[0] = w[off + 12];
|
||||
w3[1] = w[off + 13];
|
||||
w3[2] = w[off + 14];
|
||||
w3[3] = w[off + 15];
|
||||
|
||||
streebog256_update_vector_64 (ctx, w0, w1, w2, w3, len);
|
||||
}
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_update_vector_swap (streebog256_ctx_vector_t *ctx, const u32x *w, int len)
|
||||
{
|
||||
u32x w0[4];
|
||||
@ -1344,7 +1692,7 @@ DECLSPEC void streebog256_final_vector (streebog256_ctx_vector_t *ctx)
|
||||
m[6] = hl32_to_64 (ctx->w0[2], ctx->w0[3]);
|
||||
m[7] = hl32_to_64 (ctx->w0[0], ctx->w0[1]);
|
||||
|
||||
streebog256_g_vector (ctx->h, ctx->n, m);
|
||||
streebog256_g_vector (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
|
||||
|
||||
u64x sizebuf[8] = { 0 };
|
||||
sizebuf[7] = swap64 ((u64x) (ctx->len << 3));
|
||||
@ -1355,7 +1703,223 @@ DECLSPEC void streebog256_final_vector (streebog256_ctx_vector_t *ctx)
|
||||
|
||||
const u64x nullbuf[8] = { 0 };
|
||||
|
||||
streebog256_g_vector (ctx->h, nullbuf, ctx->n);
|
||||
streebog256_g_vector (ctx->h, nullbuf, ctx->n, ctx->s_sbob_sl64);
|
||||
|
||||
streebog256_g_vector (ctx->h, nullbuf, ctx->s);
|
||||
streebog256_g_vector (ctx->h, nullbuf, ctx->s, ctx->s_sbob_sl64);
|
||||
}
|
||||
|
||||
typedef struct streebog256_hmac_ctx_vector
|
||||
{
|
||||
streebog256_ctx_vector_t ipad;
|
||||
streebog256_ctx_vector_t opad;
|
||||
|
||||
} streebog256_hmac_ctx_vector_t;
|
||||
|
||||
DECLSPEC void streebog256_hmac_init_vector_64 (streebog256_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32x t0[4];
|
||||
u32x t1[4];
|
||||
u32x t2[4];
|
||||
u32x t3[4];
|
||||
|
||||
// ipad
|
||||
|
||||
t0[0] = w0[0] ^ 0x36363636;
|
||||
t0[1] = w0[1] ^ 0x36363636;
|
||||
t0[2] = w0[2] ^ 0x36363636;
|
||||
t0[3] = w0[3] ^ 0x36363636;
|
||||
t1[0] = w1[0] ^ 0x36363636;
|
||||
t1[1] = w1[1] ^ 0x36363636;
|
||||
t1[2] = w1[2] ^ 0x36363636;
|
||||
t1[3] = w1[3] ^ 0x36363636;
|
||||
t2[0] = w2[0] ^ 0x36363636;
|
||||
t2[1] = w2[1] ^ 0x36363636;
|
||||
t2[2] = w2[2] ^ 0x36363636;
|
||||
t2[3] = w2[3] ^ 0x36363636;
|
||||
t3[0] = w3[0] ^ 0x36363636;
|
||||
t3[1] = w3[1] ^ 0x36363636;
|
||||
t3[2] = w3[2] ^ 0x36363636;
|
||||
t3[3] = w3[3] ^ 0x36363636;
|
||||
|
||||
streebog256_init_vector (&ctx->ipad, s_sbob_sl64);
|
||||
|
||||
streebog256_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
|
||||
|
||||
// opad
|
||||
|
||||
t0[0] = w0[0] ^ 0x5c5c5c5c;
|
||||
t0[1] = w0[1] ^ 0x5c5c5c5c;
|
||||
t0[2] = w0[2] ^ 0x5c5c5c5c;
|
||||
t0[3] = w0[3] ^ 0x5c5c5c5c;
|
||||
t1[0] = w1[0] ^ 0x5c5c5c5c;
|
||||
t1[1] = w1[1] ^ 0x5c5c5c5c;
|
||||
t1[2] = w1[2] ^ 0x5c5c5c5c;
|
||||
t1[3] = w1[3] ^ 0x5c5c5c5c;
|
||||
t2[0] = w2[0] ^ 0x5c5c5c5c;
|
||||
t2[1] = w2[1] ^ 0x5c5c5c5c;
|
||||
t2[2] = w2[2] ^ 0x5c5c5c5c;
|
||||
t2[3] = w2[3] ^ 0x5c5c5c5c;
|
||||
t3[0] = w3[0] ^ 0x5c5c5c5c;
|
||||
t3[1] = w3[1] ^ 0x5c5c5c5c;
|
||||
t3[2] = w3[2] ^ 0x5c5c5c5c;
|
||||
t3[3] = w3[3] ^ 0x5c5c5c5c;
|
||||
|
||||
streebog256_init_vector (&ctx->opad, s_sbob_sl64);
|
||||
|
||||
streebog256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_init_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
if (len > 64)
|
||||
{
|
||||
streebog256_ctx_vector_t tmp;
|
||||
|
||||
streebog256_init_vector (&tmp, s_sbob_sl64);
|
||||
|
||||
streebog256_update_vector (&tmp, w, len);
|
||||
|
||||
streebog256_final_vector (&tmp);
|
||||
|
||||
w0[0] = h32_from_64 (tmp.h[0]);
|
||||
w0[1] = l32_from_64 (tmp.h[0]);
|
||||
w0[2] = h32_from_64 (tmp.h[1]);
|
||||
w0[3] = l32_from_64 (tmp.h[1]);
|
||||
w1[0] = h32_from_64 (tmp.h[2]);
|
||||
w1[1] = l32_from_64 (tmp.h[2]);
|
||||
w1[2] = h32_from_64 (tmp.h[3]);
|
||||
w1[3] = l32_from_64 (tmp.h[3]);
|
||||
w2[0] = h32_from_64 (tmp.h[4]);
|
||||
w2[1] = l32_from_64 (tmp.h[4]);
|
||||
w2[2] = h32_from_64 (tmp.h[5]);
|
||||
w2[3] = l32_from_64 (tmp.h[5]);
|
||||
w3[0] = h32_from_64 (tmp.h[6]);
|
||||
w3[1] = l32_from_64 (tmp.h[6]);
|
||||
w3[2] = h32_from_64 (tmp.h[7]);
|
||||
w3[3] = l32_from_64 (tmp.h[7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
w0[0] = w[ 0];
|
||||
w0[1] = w[ 1];
|
||||
w0[2] = w[ 2];
|
||||
w0[3] = w[ 3];
|
||||
w1[0] = w[ 4];
|
||||
w1[1] = w[ 5];
|
||||
w1[2] = w[ 6];
|
||||
w1[3] = w[ 7];
|
||||
w2[0] = w[ 8];
|
||||
w2[1] = w[ 9];
|
||||
w2[2] = w[10];
|
||||
w2[3] = w[11];
|
||||
w3[0] = w[12];
|
||||
w3[1] = w[13];
|
||||
w3[2] = w[14];
|
||||
w3[3] = w[15];
|
||||
}
|
||||
|
||||
streebog256_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_init_vector_swap (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
if (len > 64)
|
||||
{
|
||||
streebog256_ctx_vector_t tmp;
|
||||
|
||||
streebog256_init_vector (&tmp, s_sbob_sl64);
|
||||
|
||||
streebog256_update_vector_swap (&tmp, w, len);
|
||||
|
||||
streebog256_final_vector (&tmp);
|
||||
|
||||
w0[0] = h32_from_64 (tmp.h[0]);
|
||||
w0[1] = l32_from_64 (tmp.h[0]);
|
||||
w0[2] = h32_from_64 (tmp.h[1]);
|
||||
w0[3] = l32_from_64 (tmp.h[1]);
|
||||
w1[0] = h32_from_64 (tmp.h[2]);
|
||||
w1[1] = l32_from_64 (tmp.h[2]);
|
||||
w1[2] = h32_from_64 (tmp.h[3]);
|
||||
w1[3] = l32_from_64 (tmp.h[3]);
|
||||
w2[0] = h32_from_64 (tmp.h[4]);
|
||||
w2[1] = l32_from_64 (tmp.h[4]);
|
||||
w2[2] = h32_from_64 (tmp.h[5]);
|
||||
w2[3] = l32_from_64 (tmp.h[5]);
|
||||
w3[0] = h32_from_64 (tmp.h[6]);
|
||||
w3[1] = l32_from_64 (tmp.h[6]);
|
||||
w3[2] = h32_from_64 (tmp.h[7]);
|
||||
w3[3] = l32_from_64 (tmp.h[7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
w0[0] = swap32 (w[ 0]);
|
||||
w0[1] = swap32 (w[ 1]);
|
||||
w0[2] = swap32 (w[ 2]);
|
||||
w0[3] = swap32 (w[ 3]);
|
||||
w1[0] = swap32 (w[ 4]);
|
||||
w1[1] = swap32 (w[ 5]);
|
||||
w1[2] = swap32 (w[ 6]);
|
||||
w1[3] = swap32 (w[ 7]);
|
||||
w2[0] = swap32 (w[ 8]);
|
||||
w2[1] = swap32 (w[ 9]);
|
||||
w2[2] = swap32 (w[10]);
|
||||
w2[3] = swap32 (w[11]);
|
||||
w3[0] = swap32 (w[12]);
|
||||
w3[1] = swap32 (w[13]);
|
||||
w3[2] = swap32 (w[14]);
|
||||
w3[3] = swap32 (w[15]);
|
||||
}
|
||||
|
||||
streebog256_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_update_vector (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
|
||||
{
|
||||
streebog256_update_vector (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_update_vector_swap (streebog256_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
|
||||
{
|
||||
streebog256_update_vector_swap (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog256_hmac_final_vector (streebog256_hmac_ctx_vector_t *ctx)
|
||||
{
|
||||
streebog256_final_vector (&ctx->ipad);
|
||||
|
||||
u32x t0[4];
|
||||
u32x t1[4];
|
||||
u32x t2[4];
|
||||
u32x t3[4];
|
||||
|
||||
t0[0] = h32_from_64 (ctx->ipad.h[3]);
|
||||
t0[1] = l32_from_64 (ctx->ipad.h[3]);
|
||||
t0[2] = h32_from_64 (ctx->ipad.h[2]);
|
||||
t0[3] = l32_from_64 (ctx->ipad.h[2]);
|
||||
t1[0] = h32_from_64 (ctx->ipad.h[1]);
|
||||
t1[1] = l32_from_64 (ctx->ipad.h[1]);
|
||||
t1[2] = h32_from_64 (ctx->ipad.h[0]);
|
||||
t1[3] = l32_from_64 (ctx->ipad.h[0]);
|
||||
t2[0] = 0;
|
||||
t2[1] = 0;
|
||||
t2[2] = 0;
|
||||
t2[3] = 0;
|
||||
t3[0] = 0;
|
||||
t3[1] = 0;
|
||||
t3[2] = 0;
|
||||
t3[3] = 0;
|
||||
|
||||
streebog256_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 32);
|
||||
|
||||
streebog256_final_vector (&ctx->opad);
|
||||
}
|
||||
|
@ -608,14 +608,14 @@ __constant u64a sbob_rc64[12][8] =
|
||||
#endif
|
||||
|
||||
#define SBOG_LPSti64 \
|
||||
BOX (sbob_sl64, 0, ((t[0] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 1, ((t[1] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 2, ((t[2] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 3, ((t[3] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 4, ((t[4] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 5, ((t[5] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 6, ((t[6] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (sbob_sl64, 7, ((t[7] >> (i * 8)) & 0xff))
|
||||
BOX (s_sbob_sl64, 0, ((t[0] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 1, ((t[1] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 2, ((t[2] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 3, ((t[3] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 4, ((t[4] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 5, ((t[5] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 6, ((t[6] >> (i * 8)) & 0xff)) ^ \
|
||||
BOX (s_sbob_sl64, 7, ((t[7] >> (i * 8)) & 0xff))
|
||||
|
||||
typedef struct streebog512_ctx
|
||||
{
|
||||
@ -630,9 +630,11 @@ typedef struct streebog512_ctx
|
||||
|
||||
int len;
|
||||
|
||||
SHM_TYPE u64a (*s_sbob_sl64)[256];
|
||||
|
||||
} streebog512_ctx_t;
|
||||
|
||||
DECLSPEC void streebog512_init (streebog512_ctx_t *ctx)
|
||||
DECLSPEC void streebog512_init (streebog512_ctx_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
ctx->h[0] = 0;
|
||||
ctx->h[1] = 0;
|
||||
@ -682,11 +684,13 @@ DECLSPEC void streebog512_init (streebog512_ctx_t *ctx)
|
||||
ctx->w3[3] = 0;
|
||||
|
||||
ctx->len = 0;
|
||||
|
||||
ctx->s_sbob_sl64 = s_sbob_sl64;
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_add (u64 *x, const u64 *y)
|
||||
{
|
||||
u32 carry = 0;
|
||||
u64 carry = 0;
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -697,13 +701,13 @@ DECLSPEC void streebog512_add (u64 *x, const u64 *y)
|
||||
const u64 right = swap64_S (y[i]);
|
||||
const u64 sum = left + right + carry;
|
||||
|
||||
carry = (sum < left) ? 1 : 0;
|
||||
carry = (sum < left) ? (u64) 1 : (u64) 0;
|
||||
|
||||
x[i] = swap64_S (sum);
|
||||
}
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_g (u64 *h, const u64 *n, const u64 *m)
|
||||
DECLSPEC void streebog512_g (u64 *h, const u64 *n, const u64 *m, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u64 k[8];
|
||||
u64 s[8];
|
||||
@ -784,7 +788,7 @@ DECLSPEC void streebog512_transform (streebog512_ctx_t *ctx, const u32 *w0, cons
|
||||
m[6] = hl32_to_64_S (w0[2], w0[3]);
|
||||
m[7] = hl32_to_64_S (w0[0], w0[1]);
|
||||
|
||||
streebog512_g (ctx->h, ctx->n, m);
|
||||
streebog512_g (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
|
||||
|
||||
u64 counterbuf[8] = { 0 };
|
||||
counterbuf[7] = swap64_S ((u64) 0x200);
|
||||
@ -1057,7 +1061,7 @@ DECLSPEC void streebog512_final (streebog512_ctx_t *ctx)
|
||||
m[6] = hl32_to_64_S (ctx->w0[2], ctx->w0[3]);
|
||||
m[7] = hl32_to_64_S (ctx->w0[0], ctx->w0[1]);
|
||||
|
||||
streebog512_g (ctx->h, ctx->n, m);
|
||||
streebog512_g (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
|
||||
|
||||
u64 sizebuf[8] = { 0 };
|
||||
sizebuf[7] = swap64_S ((u64) (ctx->len << 3));
|
||||
@ -1068,9 +1072,9 @@ DECLSPEC void streebog512_final (streebog512_ctx_t *ctx)
|
||||
|
||||
const u64 nullbuf[8] = { 0 };
|
||||
|
||||
streebog512_g (ctx->h, nullbuf, ctx->n);
|
||||
streebog512_g (ctx->h, nullbuf, ctx->n, ctx->s_sbob_sl64);
|
||||
|
||||
streebog512_g (ctx->h, nullbuf, ctx->s);
|
||||
streebog512_g (ctx->h, nullbuf, ctx->s, ctx->s_sbob_sl64);
|
||||
}
|
||||
|
||||
typedef struct streebog512_hmac_ctx
|
||||
@ -1080,7 +1084,7 @@ typedef struct streebog512_hmac_ctx
|
||||
|
||||
} streebog512_hmac_ctx_t;
|
||||
|
||||
DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3)
|
||||
DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *w0, const u32 *w1, const u32 *w2, const u32 *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32 t0[4];
|
||||
u32 t1[4];
|
||||
@ -1106,7 +1110,7 @@ DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *
|
||||
t3[2] = w3[2] ^ 0x36363636;
|
||||
t3[3] = w3[3] ^ 0x36363636;
|
||||
|
||||
streebog512_init (&ctx->ipad);
|
||||
streebog512_init (&ctx->ipad, s_sbob_sl64);
|
||||
|
||||
streebog512_update_64 (&ctx->ipad, t0, t1, t2, t3, 64);
|
||||
|
||||
@ -1129,12 +1133,12 @@ DECLSPEC void streebog512_hmac_init_64 (streebog512_hmac_ctx_t *ctx, const u32 *
|
||||
t3[2] = w3[2] ^ 0x5c5c5c5c;
|
||||
t3[3] = w3[3] ^ 0x5c5c5c5c;
|
||||
|
||||
streebog512_init (&ctx->opad);
|
||||
streebog512_init (&ctx->opad, s_sbob_sl64);
|
||||
|
||||
streebog512_update_64 (&ctx->opad, t0, t1, t2, t3, 64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len)
|
||||
DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
@ -1145,7 +1149,7 @@ DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w,
|
||||
{
|
||||
streebog512_ctx_t tmp;
|
||||
|
||||
streebog512_init (&tmp);
|
||||
streebog512_init (&tmp, s_sbob_sl64);
|
||||
|
||||
streebog512_update (&tmp, w, len);
|
||||
|
||||
@ -1188,10 +1192,10 @@ DECLSPEC void streebog512_hmac_init (streebog512_hmac_ctx_t *ctx, const u32 *w,
|
||||
w3[3] = w[15];
|
||||
}
|
||||
|
||||
streebog512_hmac_init_64 (ctx, w0, w1, w2, w3);
|
||||
streebog512_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len)
|
||||
DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
@ -1202,7 +1206,7 @@ DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32
|
||||
{
|
||||
streebog512_ctx_t tmp;
|
||||
|
||||
streebog512_init (&tmp);
|
||||
streebog512_init (&tmp, s_sbob_sl64);
|
||||
|
||||
streebog512_update_swap (&tmp, w, len);
|
||||
|
||||
@ -1245,7 +1249,12 @@ DECLSPEC void streebog512_hmac_init_swap (streebog512_hmac_ctx_t *ctx, const u32
|
||||
w3[3] = swap32_S (w[15]);
|
||||
}
|
||||
|
||||
streebog512_hmac_init_64 (ctx, w0, w1, w2, w3);
|
||||
streebog512_hmac_init_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_update_64 (streebog512_hmac_ctx_t *ctx, u32 *w0, u32 *w1, u32 *w2, u32 *w3, const int len)
|
||||
{
|
||||
streebog512_update_64 (&ctx->ipad, w0, w1, w2, w3, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_update (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len)
|
||||
@ -1253,6 +1262,16 @@ DECLSPEC void streebog512_hmac_update (streebog512_hmac_ctx_t *ctx, const u32 *w
|
||||
streebog512_update (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_update_swap (streebog512_hmac_ctx_t *ctx, const u32 *w, const int len)
|
||||
{
|
||||
streebog512_update_swap (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_update_global_swap (streebog512_hmac_ctx_t *ctx, const __global u32 *w, const int len)
|
||||
{
|
||||
streebog512_update_global_swap (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_final (streebog512_hmac_ctx_t *ctx)
|
||||
{
|
||||
streebog512_final (&ctx->ipad);
|
||||
@ -1299,9 +1318,11 @@ typedef struct streebog512_ctx_vector
|
||||
|
||||
int len;
|
||||
|
||||
SHM_TYPE u64a (*s_sbob_sl64)[256];
|
||||
|
||||
} streebog512_ctx_vector_t;
|
||||
|
||||
DECLSPEC void streebog512_init_vector (streebog512_ctx_vector_t *ctx)
|
||||
DECLSPEC void streebog512_init_vector (streebog512_ctx_vector_t *ctx, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
ctx->h[0] = 0;
|
||||
ctx->h[1] = 0;
|
||||
@ -1351,11 +1372,13 @@ DECLSPEC void streebog512_init_vector (streebog512_ctx_vector_t *ctx)
|
||||
ctx->w3[3] = 0;
|
||||
|
||||
ctx->len = 0;
|
||||
|
||||
ctx->s_sbob_sl64 = s_sbob_sl64;
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_add_vector (u64x *x, const u64x *y)
|
||||
{
|
||||
u32x carry = 0;
|
||||
u64x carry = 0;
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -1366,13 +1389,13 @@ DECLSPEC void streebog512_add_vector (u64x *x, const u64x *y)
|
||||
const u64x right = swap64 (y[i]);
|
||||
const u64x sum = left + right + carry;
|
||||
|
||||
carry = (sum < left) ? 1 : 0;
|
||||
carry = (sum < left) ? (u64x) 1 : (u64x) 0;
|
||||
|
||||
x[i] = swap64 (sum);
|
||||
}
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_g_vector (u64x *h, const u64x *n, const u64x *m)
|
||||
DECLSPEC void streebog512_g_vector (u64x *h, const u64x *n, const u64x *m, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u64x k[8];
|
||||
u64x s[8];
|
||||
@ -1453,7 +1476,7 @@ DECLSPEC void streebog512_transform_vector (streebog512_ctx_vector_t *ctx, const
|
||||
m[6] = hl32_to_64 (w0[2], w0[3]);
|
||||
m[7] = hl32_to_64 (w0[0], w0[1]);
|
||||
|
||||
streebog512_g_vector (ctx->h, ctx->n, m);
|
||||
streebog512_g_vector (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
|
||||
|
||||
u64x counterbuf[8] = { 0 };
|
||||
counterbuf[7] = swap64 ((u64x) 0x200);
|
||||
@ -1669,7 +1692,7 @@ DECLSPEC void streebog512_final_vector (streebog512_ctx_vector_t *ctx)
|
||||
m[6] = hl32_to_64 (ctx->w0[2], ctx->w0[3]);
|
||||
m[7] = hl32_to_64 (ctx->w0[0], ctx->w0[1]);
|
||||
|
||||
streebog512_g_vector (ctx->h, ctx->n, m);
|
||||
streebog512_g_vector (ctx->h, ctx->n, m, ctx->s_sbob_sl64);
|
||||
|
||||
u64x sizebuf[8] = { 0 };
|
||||
sizebuf[7] = swap64 ((u64x) (ctx->len << 3));
|
||||
@ -1680,9 +1703,9 @@ DECLSPEC void streebog512_final_vector (streebog512_ctx_vector_t *ctx)
|
||||
|
||||
const u64x nullbuf[8] = { 0 };
|
||||
|
||||
streebog512_g_vector (ctx->h, nullbuf, ctx->n);
|
||||
streebog512_g_vector (ctx->h, nullbuf, ctx->n, ctx->s_sbob_sl64);
|
||||
|
||||
streebog512_g_vector (ctx->h, nullbuf, ctx->s);
|
||||
streebog512_g_vector (ctx->h, nullbuf, ctx->s, ctx->s_sbob_sl64);
|
||||
}
|
||||
|
||||
typedef struct streebog512_hmac_ctx_vector
|
||||
@ -1692,7 +1715,7 @@ typedef struct streebog512_hmac_ctx_vector
|
||||
|
||||
} streebog512_hmac_ctx_vector_t;
|
||||
|
||||
DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3)
|
||||
DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ctx, const u32x *w0, const u32x *w1, const u32x *w2, const u32x *w3, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32x t0[4];
|
||||
u32x t1[4];
|
||||
@ -1718,7 +1741,7 @@ DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ct
|
||||
t3[2] = w3[2] ^ 0x36363636;
|
||||
t3[3] = w3[3] ^ 0x36363636;
|
||||
|
||||
streebog512_init_vector (&ctx->ipad);
|
||||
streebog512_init_vector (&ctx->ipad, s_sbob_sl64);
|
||||
|
||||
streebog512_update_vector_64 (&ctx->ipad, t0, t1, t2, t3, 64);
|
||||
|
||||
@ -1741,12 +1764,12 @@ DECLSPEC void streebog512_hmac_init_vector_64 (streebog512_hmac_ctx_vector_t *ct
|
||||
t3[2] = w3[2] ^ 0x5c5c5c5c;
|
||||
t3[3] = w3[3] ^ 0x5c5c5c5c;
|
||||
|
||||
streebog512_init_vector (&ctx->opad);
|
||||
streebog512_init_vector (&ctx->opad, s_sbob_sl64);
|
||||
|
||||
streebog512_update_vector_64 (&ctx->opad, t0, t1, t2, t3, 64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
|
||||
DECLSPEC void streebog512_hmac_init_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
@ -1757,7 +1780,7 @@ DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t *
|
||||
{
|
||||
streebog512_ctx_vector_t tmp;
|
||||
|
||||
streebog512_init_vector (&tmp);
|
||||
streebog512_init_vector (&tmp, s_sbob_sl64);
|
||||
|
||||
streebog512_update_vector (&tmp, w, len);
|
||||
|
||||
@ -1781,6 +1804,63 @@ DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t *
|
||||
w3[3] = l32_from_64 (tmp.h[7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
w0[0] = w[ 0];
|
||||
w0[1] = w[ 1];
|
||||
w0[2] = w[ 2];
|
||||
w0[3] = w[ 3];
|
||||
w1[0] = w[ 4];
|
||||
w1[1] = w[ 5];
|
||||
w1[2] = w[ 6];
|
||||
w1[3] = w[ 7];
|
||||
w2[0] = w[ 8];
|
||||
w2[1] = w[ 9];
|
||||
w2[2] = w[10];
|
||||
w2[3] = w[11];
|
||||
w3[0] = w[12];
|
||||
w3[1] = w[13];
|
||||
w3[2] = w[14];
|
||||
w3[3] = w[15];
|
||||
}
|
||||
|
||||
streebog512_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
if (len > 64)
|
||||
{
|
||||
streebog512_ctx_vector_t tmp;
|
||||
|
||||
streebog512_init_vector (&tmp, s_sbob_sl64);
|
||||
|
||||
streebog512_update_vector_swap (&tmp, w, len);
|
||||
|
||||
streebog512_final_vector (&tmp);
|
||||
|
||||
w0[0] = h32_from_64 (tmp.h[0]);
|
||||
w0[1] = l32_from_64 (tmp.h[0]);
|
||||
w0[2] = h32_from_64 (tmp.h[1]);
|
||||
w0[3] = l32_from_64 (tmp.h[1]);
|
||||
w1[0] = h32_from_64 (tmp.h[2]);
|
||||
w1[1] = l32_from_64 (tmp.h[2]);
|
||||
w1[2] = h32_from_64 (tmp.h[3]);
|
||||
w1[3] = l32_from_64 (tmp.h[3]);
|
||||
w2[0] = h32_from_64 (tmp.h[4]);
|
||||
w2[1] = l32_from_64 (tmp.h[4]);
|
||||
w2[2] = h32_from_64 (tmp.h[5]);
|
||||
w2[3] = l32_from_64 (tmp.h[5]);
|
||||
w3[0] = h32_from_64 (tmp.h[6]);
|
||||
w3[1] = l32_from_64 (tmp.h[6]);
|
||||
w3[2] = h32_from_64 (tmp.h[7]);
|
||||
w3[3] = l32_from_64 (tmp.h[7]);
|
||||
}
|
||||
else
|
||||
{
|
||||
w0[0] = swap32 (w[ 0]);
|
||||
w0[1] = swap32 (w[ 1]);
|
||||
@ -1800,7 +1880,7 @@ DECLSPEC void streebog512_hmac_init_vector_swap (streebog512_hmac_ctx_vector_t *
|
||||
w3[3] = swap32 (w[15]);
|
||||
}
|
||||
|
||||
streebog512_hmac_init_vector_64 (ctx, w0, w1, w2, w3);
|
||||
streebog512_hmac_init_vector_64 (ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_update_vector (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
|
||||
@ -1808,6 +1888,11 @@ DECLSPEC void streebog512_hmac_update_vector (streebog512_hmac_ctx_vector_t *ctx
|
||||
streebog512_update_vector (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_update_vector_swap (streebog512_hmac_ctx_vector_t *ctx, const u32x *w, const int len)
|
||||
{
|
||||
streebog512_update_vector_swap (&ctx->ipad, w, len);
|
||||
}
|
||||
|
||||
DECLSPEC void streebog512_hmac_final_vector (streebog512_hmac_ctx_vector_t *ctx)
|
||||
{
|
||||
streebog512_final_vector (&ctx->ipad);
|
||||
|
@ -1714,6 +1714,19 @@ typedef struct tc64_tmp
|
||||
|
||||
} tc64_tmp_t;
|
||||
|
||||
typedef struct vc64_sbog_tmp
|
||||
{
|
||||
u64 ipad_raw[8];
|
||||
u64 opad_raw[8];
|
||||
|
||||
u64 ipad_hash[8];
|
||||
u64 opad_hash[8];
|
||||
|
||||
u64 dgst[32];
|
||||
u64 out[32];
|
||||
|
||||
} vc64_sbog_tmp_t;
|
||||
|
||||
typedef struct pbkdf1_sha1_tmp
|
||||
{
|
||||
// pbkdf1-sha1 is limited to 160 bits
|
||||
|
@ -21,8 +21,37 @@ __kernel void m11700_mxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -44,7 +73,7 @@ __kernel void m11700_mxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
|
||||
streebog256_ctx_t ctx;
|
||||
|
||||
streebog256_init (&ctx);
|
||||
streebog256_init (&ctx, s_sbob_sl64);
|
||||
|
||||
streebog256_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
@ -65,8 +94,37 @@ __kernel void m11700_sxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -100,7 +158,7 @@ __kernel void m11700_sxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
|
||||
streebog256_ctx_t ctx;
|
||||
|
||||
streebog256_init (&ctx);
|
||||
streebog256_init (&ctx, s_sbob_sl64);
|
||||
|
||||
streebog256_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
|
@ -19,8 +19,37 @@ __kernel void m11700_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -30,7 +59,7 @@ __kernel void m11700_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog256_ctx_t ctx0;
|
||||
|
||||
streebog256_init (&ctx0);
|
||||
streebog256_init (&ctx0, s_sbob_sl64);
|
||||
|
||||
streebog256_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
@ -61,8 +90,37 @@ __kernel void m11700_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -84,7 +142,7 @@ __kernel void m11700_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog256_ctx_t ctx0;
|
||||
|
||||
streebog256_init (&ctx0);
|
||||
streebog256_init (&ctx0, s_sbob_sl64);
|
||||
|
||||
streebog256_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#define NEW_SIMD_CODE
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#include "inc_vendor.cl"
|
||||
#include "inc_hash_constants.h"
|
||||
@ -19,8 +19,37 @@ __kernel void m11700_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -53,7 +82,7 @@ __kernel void m11700_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog256_ctx_vector_t ctx;
|
||||
|
||||
streebog256_init_vector (&ctx);
|
||||
streebog256_init_vector (&ctx, s_sbob_sl64);
|
||||
|
||||
streebog256_update_vector_swap (&ctx, w, pw_len);
|
||||
|
||||
@ -74,8 +103,37 @@ __kernel void m11700_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -120,7 +178,7 @@ __kernel void m11700_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog256_ctx_vector_t ctx;
|
||||
|
||||
streebog256_init_vector (&ctx);
|
||||
streebog256_init_vector (&ctx, s_sbob_sl64);
|
||||
|
||||
streebog256_update_vector_swap (&ctx, w, pw_len);
|
||||
|
||||
|
192
OpenCL/m11750_a0-pure.cl
Normal file
192
OpenCL/m11750_a0-pure.cl
Normal file
@ -0,0 +1,192 @@
|
||||
/**
|
||||
* 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_rp.h"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_scalar.cl"
|
||||
#include "inc_hash_streebog256.cl"
|
||||
|
||||
__kernel void m11750_mxx (__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)
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog256_hmac_ctx_t ctx;
|
||||
|
||||
streebog256_hmac_init_swap (&ctx, tmp.i, tmp.pw_len, s_sbob_sl64);
|
||||
|
||||
streebog256_hmac_update (&ctx, s, salt_len);
|
||||
|
||||
streebog256_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m11750_sxx (__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)
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog256_hmac_ctx_t ctx;
|
||||
|
||||
streebog256_hmac_init_swap (&ctx, tmp.i, tmp.pw_len, s_sbob_sl64);
|
||||
|
||||
streebog256_hmac_update (&ctx, s, salt_len);
|
||||
|
||||
streebog256_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
240
OpenCL/m11750_a1-pure.cl
Normal file
240
OpenCL/m11750_a1-pure.cl
Normal file
@ -0,0 +1,240 @@
|
||||
/**
|
||||
* 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_streebog256.cl"
|
||||
|
||||
__kernel void m11750_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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32 w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = swap32_S (pws[gid].i[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
const u32 comb_len = combs_buf[il_pos].pw_len;
|
||||
|
||||
u32 c[64];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int idx = 0; idx < 64; idx++)
|
||||
{
|
||||
c[idx] = swap32_S (combs_buf[il_pos].i[idx]);
|
||||
}
|
||||
|
||||
switch_buffer_by_offset_1x64_be_S (c, pw_len);
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_t ctx;
|
||||
|
||||
streebog256_hmac_init (&ctx, c, pw_len + comb_len, s_sbob_sl64);
|
||||
|
||||
streebog256_hmac_update (&ctx, s, salt_len);
|
||||
|
||||
streebog256_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m11750_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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32 w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = swap32_S (pws[gid].i[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
const u32 comb_len = combs_buf[il_pos].pw_len;
|
||||
|
||||
u32 c[64];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int idx = 0; idx < 64; idx++)
|
||||
{
|
||||
c[idx] = swap32_S (combs_buf[il_pos].i[idx]);
|
||||
}
|
||||
|
||||
switch_buffer_by_offset_1x64_be_S (c, pw_len);
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_t ctx;
|
||||
|
||||
streebog256_hmac_init (&ctx, c, pw_len + comb_len, s_sbob_sl64);
|
||||
|
||||
streebog256_hmac_update (&ctx, s, salt_len);
|
||||
|
||||
streebog256_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
212
OpenCL/m11750_a3-pure.cl
Normal file
212
OpenCL/m11750_a3-pure.cl
Normal file
@ -0,0 +1,212 @@
|
||||
/**
|
||||
* 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_streebog256.cl"
|
||||
|
||||
__kernel void m11750_mxx (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __constant const u32x *words_buf_r, __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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32x s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
streebog256_hmac_ctx_vector_t ctx;
|
||||
|
||||
streebog256_hmac_init_vector_swap (&ctx, w, pw_len, s_sbob_sl64);
|
||||
|
||||
streebog256_hmac_update_vector (&ctx, s, salt_len);
|
||||
|
||||
streebog256_hmac_final_vector (&ctx);
|
||||
|
||||
const u32x r0 = l32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r1 = h32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r2 = l32_from_64 (ctx.opad.h[1]);
|
||||
const u32x r3 = h32_from_64 (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_M_SIMD (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m11750_sxx (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __constant const u32x *words_buf_r, __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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32x s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
streebog256_hmac_ctx_vector_t ctx;
|
||||
|
||||
streebog256_hmac_init_vector_swap (&ctx, w, pw_len, s_sbob_sl64);
|
||||
|
||||
streebog256_hmac_update_vector (&ctx, s, salt_len);
|
||||
|
||||
streebog256_hmac_final_vector (&ctx);
|
||||
|
||||
const u32x r0 = l32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r1 = h32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r2 = l32_from_64 (ctx.opad.h[1]);
|
||||
const u32x r3 = h32_from_64 (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_S_SIMD (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
196
OpenCL/m11760_a0-pure.cl
Normal file
196
OpenCL/m11760_a0-pure.cl
Normal file
@ -0,0 +1,196 @@
|
||||
/**
|
||||
* 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_rp.h"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_scalar.cl"
|
||||
#include "inc_hash_streebog256.cl"
|
||||
|
||||
__kernel void m11760_mxx (__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)
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_t ctx0;
|
||||
|
||||
streebog256_hmac_init (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog256_hmac_ctx_t ctx = ctx0;
|
||||
|
||||
streebog256_hmac_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog256_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m11760_sxx (__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)
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_t ctx0;
|
||||
|
||||
streebog256_hmac_init (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog256_hmac_ctx_t ctx = ctx0;
|
||||
|
||||
streebog256_hmac_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog256_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
244
OpenCL/m11760_a1-pure.cl
Normal file
244
OpenCL/m11760_a1-pure.cl
Normal file
@ -0,0 +1,244 @@
|
||||
/**
|
||||
* 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_streebog256.cl"
|
||||
|
||||
__kernel void m11760_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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32 w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = swap32_S (pws[gid].i[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_t ctx0;
|
||||
|
||||
streebog256_hmac_init (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
const u32 comb_len = combs_buf[il_pos].pw_len;
|
||||
|
||||
u32 c[64];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int idx = 0; idx < 64; idx++)
|
||||
{
|
||||
c[idx] = swap32_S (combs_buf[il_pos].i[idx]);
|
||||
}
|
||||
|
||||
switch_buffer_by_offset_1x64_be_S (c, pw_len);
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_t ctx = ctx0;
|
||||
|
||||
streebog256_hmac_update (&ctx, c, pw_len + comb_len);
|
||||
|
||||
streebog256_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m11760_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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32 w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = swap32_S (pws[gid].i[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_t ctx0;
|
||||
|
||||
streebog256_hmac_init (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
const u32 comb_len = combs_buf[il_pos].pw_len;
|
||||
|
||||
u32 c[64];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int idx = 0; idx < 64; idx++)
|
||||
{
|
||||
c[idx] = swap32_S (combs_buf[il_pos].i[idx]);
|
||||
}
|
||||
|
||||
switch_buffer_by_offset_1x64_be_S (c, pw_len);
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_t ctx = ctx0;
|
||||
|
||||
streebog256_hmac_update (&ctx, c, pw_len + comb_len);
|
||||
|
||||
streebog256_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
216
OpenCL/m11760_a3-pure.cl
Normal file
216
OpenCL/m11760_a3-pure.cl
Normal file
@ -0,0 +1,216 @@
|
||||
/**
|
||||
* 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_streebog256.cl"
|
||||
|
||||
__kernel void m11760_mxx (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __constant const u32x *words_buf_r, __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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32x s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_vector_t ctx0;
|
||||
|
||||
streebog256_hmac_init_vector (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
streebog256_hmac_ctx_vector_t ctx = ctx0;
|
||||
|
||||
streebog256_hmac_update_vector_swap (&ctx, w, pw_len);
|
||||
|
||||
streebog256_hmac_final_vector (&ctx);
|
||||
|
||||
const u32x r0 = l32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r1 = h32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r2 = l32_from_64 (ctx.opad.h[1]);
|
||||
const u32x r3 = h32_from_64 (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_M_SIMD (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m11760_sxx (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __constant const u32x *words_buf_r, __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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32x s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog256_hmac_ctx_vector_t ctx0;
|
||||
|
||||
streebog256_hmac_init_vector (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
streebog256_hmac_ctx_vector_t ctx = ctx0;
|
||||
|
||||
streebog256_hmac_update_vector_swap (&ctx, w, pw_len);
|
||||
|
||||
streebog256_hmac_final_vector (&ctx);
|
||||
|
||||
const u32x r0 = l32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r1 = h32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r2 = l32_from_64 (ctx.opad.h[1]);
|
||||
const u32x r3 = h32_from_64 (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_S_SIMD (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
@ -21,8 +21,37 @@ __kernel void m11800_mxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -44,7 +73,7 @@ __kernel void m11800_mxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
|
||||
streebog512_ctx_t ctx;
|
||||
|
||||
streebog512_init (&ctx);
|
||||
streebog512_init (&ctx, s_sbob_sl64);
|
||||
|
||||
streebog512_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
@ -65,8 +94,37 @@ __kernel void m11800_sxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -100,7 +158,7 @@ __kernel void m11800_sxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
|
||||
streebog512_ctx_t ctx;
|
||||
|
||||
streebog512_init (&ctx);
|
||||
streebog512_init (&ctx, s_sbob_sl64);
|
||||
|
||||
streebog512_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
|
@ -19,8 +19,37 @@ __kernel void m11800_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -30,7 +59,7 @@ __kernel void m11800_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog512_ctx_t ctx0;
|
||||
|
||||
streebog512_init (&ctx0);
|
||||
streebog512_init (&ctx0, s_sbob_sl64);
|
||||
|
||||
streebog512_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
@ -61,8 +90,37 @@ __kernel void m11800_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -84,7 +142,7 @@ __kernel void m11800_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog512_ctx_t ctx0;
|
||||
|
||||
streebog512_init (&ctx0);
|
||||
streebog512_init (&ctx0, s_sbob_sl64);
|
||||
|
||||
streebog512_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#define NEW_SIMD_CODE
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#include "inc_vendor.cl"
|
||||
#include "inc_hash_constants.h"
|
||||
@ -19,8 +19,37 @@ __kernel void m11800_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -53,7 +82,7 @@ __kernel void m11800_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog512_ctx_vector_t ctx;
|
||||
|
||||
streebog512_init_vector (&ctx);
|
||||
streebog512_init_vector (&ctx, s_sbob_sl64);
|
||||
|
||||
streebog512_update_vector_swap (&ctx, w, pw_len);
|
||||
|
||||
@ -74,8 +103,37 @@ __kernel void m11800_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -120,7 +178,7 @@ __kernel void m11800_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog512_ctx_vector_t ctx;
|
||||
|
||||
streebog512_init_vector (&ctx);
|
||||
streebog512_init_vector (&ctx, s_sbob_sl64);
|
||||
|
||||
streebog512_update_vector_swap (&ctx, w, pw_len);
|
||||
|
||||
|
@ -21,8 +21,37 @@ __kernel void m11850_mxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -53,7 +82,7 @@ __kernel void m11850_mxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
|
||||
streebog512_hmac_ctx_t ctx;
|
||||
|
||||
streebog512_hmac_init_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
streebog512_hmac_init_swap (&ctx, tmp.i, tmp.pw_len, s_sbob_sl64);
|
||||
|
||||
streebog512_hmac_update (&ctx, s, salt_len);
|
||||
|
||||
@ -74,8 +103,37 @@ __kernel void m11850_sxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -118,7 +176,7 @@ __kernel void m11850_sxx (__global pw_t *pws, __constant const kernel_rule_t *ru
|
||||
|
||||
streebog512_hmac_ctx_t ctx;
|
||||
|
||||
streebog512_hmac_init_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
streebog512_hmac_init_swap (&ctx, tmp.i, tmp.pw_len, s_sbob_sl64);
|
||||
|
||||
streebog512_hmac_update (&ctx, s, salt_len);
|
||||
|
||||
|
@ -19,8 +19,37 @@ __kernel void m11850_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -76,7 +105,7 @@ __kernel void m11850_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog512_hmac_ctx_t ctx;
|
||||
|
||||
streebog512_hmac_init (&ctx, c, pw_len + comb_len);
|
||||
streebog512_hmac_init (&ctx, c, pw_len + comb_len, s_sbob_sl64);
|
||||
|
||||
streebog512_hmac_update (&ctx, s, salt_len);
|
||||
|
||||
@ -97,8 +126,37 @@ __kernel void m11850_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -166,7 +224,7 @@ __kernel void m11850_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog512_hmac_ctx_t ctx;
|
||||
|
||||
streebog512_hmac_init (&ctx, c, pw_len + comb_len);
|
||||
streebog512_hmac_init (&ctx, c, pw_len + comb_len, s_sbob_sl64);
|
||||
|
||||
streebog512_hmac_update (&ctx, s, salt_len);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#define NEW_SIMD_CODE
|
||||
//#define NEW_SIMD_CODE
|
||||
|
||||
#include "inc_vendor.cl"
|
||||
#include "inc_hash_constants.h"
|
||||
@ -19,8 +19,37 @@ __kernel void m11850_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -62,7 +91,7 @@ __kernel void m11850_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog512_hmac_ctx_vector_t ctx;
|
||||
|
||||
streebog512_hmac_init_vector_swap (&ctx, w, pw_len);
|
||||
streebog512_hmac_init_vector_swap (&ctx, w, pw_len, s_sbob_sl64);
|
||||
|
||||
streebog512_hmac_update_vector (&ctx, s, salt_len);
|
||||
|
||||
@ -83,8 +112,37 @@ __kernel void m11850_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
@ -138,7 +196,7 @@ __kernel void m11850_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
|
||||
|
||||
streebog512_hmac_ctx_vector_t ctx;
|
||||
|
||||
streebog512_hmac_init_vector_swap (&ctx, w, pw_len);
|
||||
streebog512_hmac_init_vector_swap (&ctx, w, pw_len, s_sbob_sl64);
|
||||
|
||||
streebog512_hmac_update_vector (&ctx, s, salt_len);
|
||||
|
||||
|
196
OpenCL/m11860_a0-pure.cl
Normal file
196
OpenCL/m11860_a0-pure.cl
Normal file
@ -0,0 +1,196 @@
|
||||
/**
|
||||
* 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_rp.h"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_scalar.cl"
|
||||
#include "inc_hash_streebog512.cl"
|
||||
|
||||
__kernel void m11860_mxx (__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)
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog512_hmac_ctx_t ctx0;
|
||||
|
||||
streebog512_hmac_init (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog512_hmac_ctx_t ctx = ctx0;
|
||||
|
||||
streebog512_hmac_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog512_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m11860_sxx (__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)
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
COPY_PW (pws[gid]);
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog512_hmac_ctx_t ctx0;
|
||||
|
||||
streebog512_hmac_init (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
||||
tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog512_hmac_ctx_t ctx = ctx0;
|
||||
|
||||
streebog512_hmac_update_swap (&ctx, tmp.i, tmp.pw_len);
|
||||
|
||||
streebog512_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
244
OpenCL/m11860_a1-pure.cl
Normal file
244
OpenCL/m11860_a1-pure.cl
Normal file
@ -0,0 +1,244 @@
|
||||
/**
|
||||
* 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_streebog512.cl"
|
||||
|
||||
__kernel void m11860_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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32 w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = swap32_S (pws[gid].i[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog512_hmac_ctx_t ctx0;
|
||||
|
||||
streebog512_hmac_init (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
const u32 comb_len = combs_buf[il_pos].pw_len;
|
||||
|
||||
u32 c[64];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int idx = 0; idx < 64; idx++)
|
||||
{
|
||||
c[idx] = swap32_S (combs_buf[il_pos].i[idx]);
|
||||
}
|
||||
|
||||
switch_buffer_by_offset_1x64_be_S (c, pw_len);
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
streebog512_hmac_ctx_t ctx = ctx0;
|
||||
|
||||
streebog512_hmac_update (&ctx, c, pw_len + comb_len);
|
||||
|
||||
streebog512_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_M_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m11860_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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32 w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = swap32_S (pws[gid].i[idx]);
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32 s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog512_hmac_ctx_t ctx0;
|
||||
|
||||
streebog512_hmac_init (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
const u32 comb_len = combs_buf[il_pos].pw_len;
|
||||
|
||||
u32 c[64];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int idx = 0; idx < 64; idx++)
|
||||
{
|
||||
c[idx] = swap32_S (combs_buf[il_pos].i[idx]);
|
||||
}
|
||||
|
||||
switch_buffer_by_offset_1x64_be_S (c, pw_len);
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
streebog512_hmac_ctx_t ctx = ctx0;
|
||||
|
||||
streebog512_hmac_update (&ctx, c, pw_len + comb_len);
|
||||
|
||||
streebog512_hmac_final (&ctx);
|
||||
|
||||
const u32 r0 = l32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r1 = h32_from_64_S (ctx.opad.h[0]);
|
||||
const u32 r2 = l32_from_64_S (ctx.opad.h[1]);
|
||||
const u32 r3 = h32_from_64_S (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_S_SCALAR (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
216
OpenCL/m11860_a3-pure.cl
Normal file
216
OpenCL/m11860_a3-pure.cl
Normal file
@ -0,0 +1,216 @@
|
||||
/**
|
||||
* 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_streebog512.cl"
|
||||
|
||||
__kernel void m11860_mxx (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __constant const u32x *words_buf_r, __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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32x s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog512_hmac_ctx_vector_t ctx0;
|
||||
|
||||
streebog512_hmac_init_vector (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
streebog512_hmac_ctx_vector_t ctx = ctx0;
|
||||
|
||||
streebog512_hmac_update_vector_swap (&ctx, w, pw_len);
|
||||
|
||||
streebog512_hmac_final_vector (&ctx);
|
||||
|
||||
const u32x r0 = l32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r1 = h32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r2 = l32_from_64 (ctx.opad.h[1]);
|
||||
const u32x r3 = h32_from_64 (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_M_SIMD (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m11860_sxx (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __constant const u32x *words_buf_r, __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 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
const u32 pw_len = pws[gid].pw_len;
|
||||
|
||||
u32x w[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < pw_len; i += 4, idx += 1)
|
||||
{
|
||||
w[idx] = pws[gid].i[idx];
|
||||
}
|
||||
|
||||
const u32 salt_len = salt_bufs[salt_pos].salt_len;
|
||||
|
||||
u32x s[64] = { 0 };
|
||||
|
||||
for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1)
|
||||
{
|
||||
s[idx] = swap32_S (salt_bufs[salt_pos].salt_buf[idx]);
|
||||
}
|
||||
|
||||
streebog512_hmac_ctx_vector_t ctx0;
|
||||
|
||||
streebog512_hmac_init_vector (&ctx0, s, salt_len, s_sbob_sl64);
|
||||
|
||||
/**
|
||||
* loop
|
||||
*/
|
||||
|
||||
u32x w0l = w[0];
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
|
||||
{
|
||||
const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
|
||||
|
||||
const u32x w0 = w0l | w0r;
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
streebog512_hmac_ctx_vector_t ctx = ctx0;
|
||||
|
||||
streebog512_hmac_update_vector_swap (&ctx, w, pw_len);
|
||||
|
||||
streebog512_hmac_final_vector (&ctx);
|
||||
|
||||
const u32x r0 = l32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r1 = h32_from_64 (ctx.opad.h[0]);
|
||||
const u32x r2 = l32_from_64 (ctx.opad.h[1]);
|
||||
const u32x r3 = h32_from_64 (ctx.opad.h[1]);
|
||||
|
||||
COMPARE_S_SIMD (r0, r1, r2, r3);
|
||||
}
|
||||
}
|
576
OpenCL/m13771-pure.cl
Normal file
576
OpenCL/m13771-pure.cl
Normal file
@ -0,0 +1,576 @@
|
||||
/**
|
||||
* 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_streebog512.cl"
|
||||
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_cipher_twofish.cl"
|
||||
#include "inc_cipher_serpent.cl"
|
||||
|
||||
#include "inc_truecrypt_crc32.cl"
|
||||
#include "inc_truecrypt_xts.cl"
|
||||
|
||||
DECLSPEC u32 u8add (const u32 a, const u32 b)
|
||||
{
|
||||
const u32 a1 = (a >> 0) & 0xff;
|
||||
const u32 a2 = (a >> 8) & 0xff;
|
||||
const u32 a3 = (a >> 16) & 0xff;
|
||||
const u32 a4 = (a >> 24) & 0xff;
|
||||
|
||||
const u32 b1 = (b >> 0) & 0xff;
|
||||
const u32 b2 = (b >> 8) & 0xff;
|
||||
const u32 b3 = (b >> 16) & 0xff;
|
||||
const u32 b4 = (b >> 24) & 0xff;
|
||||
|
||||
const u32 r1 = (a1 + b1) & 0xff;
|
||||
const u32 r2 = (a2 + b2) & 0xff;
|
||||
const u32 r3 = (a3 + b3) & 0xff;
|
||||
const u32 r4 = (a4 + b4) & 0xff;
|
||||
|
||||
const u32 r = r1 << 0
|
||||
| r2 << 8
|
||||
| r3 << 16
|
||||
| r4 << 24;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipad_hash, u64x *opad_hash, u64x *ipad_raw, u64x *opad_raw, u64x *digest, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
const u64x nullbuf[8] = { 0 };
|
||||
u64x counterbuf[8] = { 0 };
|
||||
u64x padding[8] = { 0 };
|
||||
u64x message[8];
|
||||
|
||||
padding[7] = swap64 ((u64x) 0x01);
|
||||
|
||||
//inner HMAC: ipad + message
|
||||
|
||||
//first transform: precalculated ipad hash
|
||||
counterbuf[7] = swap64 ((u64x) 0x200);
|
||||
|
||||
//second transform: message = previous HMAC digest
|
||||
message[7] = hl32_to_64 (w3[2], w3[3]);
|
||||
message[6] = hl32_to_64 (w3[0], w3[1]);
|
||||
message[5] = hl32_to_64 (w2[2], w2[3]);
|
||||
message[4] = hl32_to_64 (w2[0], w2[1]);
|
||||
message[3] = hl32_to_64 (w1[2], w1[3]);
|
||||
message[2] = hl32_to_64 (w1[0], w1[1]);
|
||||
message[1] = hl32_to_64 (w0[2], w0[3]);
|
||||
message[0] = hl32_to_64 (w0[0], w0[1]);
|
||||
|
||||
digest[0] = ipad_hash[0];
|
||||
digest[1] = ipad_hash[1];
|
||||
digest[2] = ipad_hash[2];
|
||||
digest[3] = ipad_hash[3];
|
||||
digest[4] = ipad_hash[4];
|
||||
digest[5] = ipad_hash[5];
|
||||
digest[6] = ipad_hash[6];
|
||||
digest[7] = ipad_hash[7];
|
||||
|
||||
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
|
||||
|
||||
counterbuf[7] = swap64 ((u64x) 0x400);
|
||||
|
||||
//final: padding byte
|
||||
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);
|
||||
|
||||
streebog512_add_vector (message, ipad_raw);
|
||||
streebog512_add_vector (message, padding);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, counterbuf, s_sbob_sl64);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, message, s_sbob_sl64);
|
||||
|
||||
//outer HMAC: opad + digest
|
||||
|
||||
//first transform: precalculated opad hash
|
||||
counterbuf[7] = swap64 ((u64x) 0x200);
|
||||
|
||||
//second transform: message = inner HMAC digest
|
||||
message[0] = digest[0];
|
||||
message[1] = digest[1];
|
||||
message[2] = digest[2];
|
||||
message[3] = digest[3];
|
||||
message[4] = digest[4];
|
||||
message[5] = digest[5];
|
||||
message[6] = digest[6];
|
||||
message[7] = digest[7];
|
||||
|
||||
digest[0] = opad_hash[0];
|
||||
digest[1] = opad_hash[1];
|
||||
digest[2] = opad_hash[2];
|
||||
digest[3] = opad_hash[3];
|
||||
digest[4] = opad_hash[4];
|
||||
digest[5] = opad_hash[5];
|
||||
digest[6] = opad_hash[6];
|
||||
digest[7] = opad_hash[7];
|
||||
|
||||
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
|
||||
|
||||
counterbuf[7] = swap64 ((u64x) 0x400);
|
||||
|
||||
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);
|
||||
|
||||
streebog512_add_vector (message, opad_raw);
|
||||
streebog512_add_vector (message, padding);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, counterbuf, s_sbob_sl64);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, message, s_sbob_sl64);
|
||||
}
|
||||
|
||||
__kernel void m13771_init (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global vc64_sbog_tmp_t *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 tc_t *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)
|
||||
{
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
|
||||
w0[0] = pws[gid].i[ 0];
|
||||
w0[1] = pws[gid].i[ 1];
|
||||
w0[2] = pws[gid].i[ 2];
|
||||
w0[3] = pws[gid].i[ 3];
|
||||
w1[0] = pws[gid].i[ 4];
|
||||
w1[1] = pws[gid].i[ 5];
|
||||
w1[2] = pws[gid].i[ 6];
|
||||
w1[3] = pws[gid].i[ 7];
|
||||
w2[0] = pws[gid].i[ 8];
|
||||
w2[1] = pws[gid].i[ 9];
|
||||
w2[2] = pws[gid].i[10];
|
||||
w2[3] = pws[gid].i[11];
|
||||
w3[0] = pws[gid].i[12];
|
||||
w3[1] = pws[gid].i[13];
|
||||
w3[2] = pws[gid].i[14];
|
||||
w3[3] = pws[gid].i[15];
|
||||
|
||||
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
|
||||
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);
|
||||
w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]);
|
||||
w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]);
|
||||
w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]);
|
||||
w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]);
|
||||
w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]);
|
||||
w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]);
|
||||
w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]);
|
||||
w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]);
|
||||
w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]);
|
||||
w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]);
|
||||
w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]);
|
||||
w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]);
|
||||
w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]);
|
||||
w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]);
|
||||
|
||||
w0[0] = swap32_S (w0[0]);
|
||||
w0[1] = swap32_S (w0[1]);
|
||||
w0[2] = swap32_S (w0[2]);
|
||||
w0[3] = swap32_S (w0[3]);
|
||||
w1[0] = swap32_S (w1[0]);
|
||||
w1[1] = swap32_S (w1[1]);
|
||||
w1[2] = swap32_S (w1[2]);
|
||||
w1[3] = swap32_S (w1[3]);
|
||||
w2[0] = swap32_S (w2[0]);
|
||||
w2[1] = swap32_S (w2[1]);
|
||||
w2[2] = swap32_S (w2[2]);
|
||||
w2[3] = swap32_S (w2[3]);
|
||||
w3[0] = swap32_S (w3[0]);
|
||||
w3[1] = swap32_S (w3[1]);
|
||||
w3[2] = swap32_S (w3[2]);
|
||||
w3[3] = swap32_S (w3[3]);
|
||||
|
||||
streebog512_hmac_ctx_t streebog512_hmac_ctx;
|
||||
|
||||
streebog512_hmac_init_64 (&streebog512_hmac_ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
|
||||
tmps[gid].ipad_hash[0] = streebog512_hmac_ctx.ipad.h[0];
|
||||
tmps[gid].ipad_hash[1] = streebog512_hmac_ctx.ipad.h[1];
|
||||
tmps[gid].ipad_hash[2] = streebog512_hmac_ctx.ipad.h[2];
|
||||
tmps[gid].ipad_hash[3] = streebog512_hmac_ctx.ipad.h[3];
|
||||
tmps[gid].ipad_hash[4] = streebog512_hmac_ctx.ipad.h[4];
|
||||
tmps[gid].ipad_hash[5] = streebog512_hmac_ctx.ipad.h[5];
|
||||
tmps[gid].ipad_hash[6] = streebog512_hmac_ctx.ipad.h[6];
|
||||
tmps[gid].ipad_hash[7] = streebog512_hmac_ctx.ipad.h[7];
|
||||
|
||||
tmps[gid].opad_hash[0] = streebog512_hmac_ctx.opad.h[0];
|
||||
tmps[gid].opad_hash[1] = streebog512_hmac_ctx.opad.h[1];
|
||||
tmps[gid].opad_hash[2] = streebog512_hmac_ctx.opad.h[2];
|
||||
tmps[gid].opad_hash[3] = streebog512_hmac_ctx.opad.h[3];
|
||||
tmps[gid].opad_hash[4] = streebog512_hmac_ctx.opad.h[4];
|
||||
tmps[gid].opad_hash[5] = streebog512_hmac_ctx.opad.h[5];
|
||||
tmps[gid].opad_hash[6] = streebog512_hmac_ctx.opad.h[6];
|
||||
tmps[gid].opad_hash[7] = streebog512_hmac_ctx.opad.h[7];
|
||||
|
||||
tmps[gid].ipad_raw[0] = streebog512_hmac_ctx.ipad.s[0];
|
||||
tmps[gid].ipad_raw[1] = streebog512_hmac_ctx.ipad.s[1];
|
||||
tmps[gid].ipad_raw[2] = streebog512_hmac_ctx.ipad.s[2];
|
||||
tmps[gid].ipad_raw[3] = streebog512_hmac_ctx.ipad.s[3];
|
||||
tmps[gid].ipad_raw[4] = streebog512_hmac_ctx.ipad.s[4];
|
||||
tmps[gid].ipad_raw[5] = streebog512_hmac_ctx.ipad.s[5];
|
||||
tmps[gid].ipad_raw[6] = streebog512_hmac_ctx.ipad.s[6];
|
||||
tmps[gid].ipad_raw[7] = streebog512_hmac_ctx.ipad.s[7];
|
||||
|
||||
tmps[gid].opad_raw[0] = streebog512_hmac_ctx.opad.s[0];
|
||||
tmps[gid].opad_raw[1] = streebog512_hmac_ctx.opad.s[1];
|
||||
tmps[gid].opad_raw[2] = streebog512_hmac_ctx.opad.s[2];
|
||||
tmps[gid].opad_raw[3] = streebog512_hmac_ctx.opad.s[3];
|
||||
tmps[gid].opad_raw[4] = streebog512_hmac_ctx.opad.s[4];
|
||||
tmps[gid].opad_raw[5] = streebog512_hmac_ctx.opad.s[5];
|
||||
tmps[gid].opad_raw[6] = streebog512_hmac_ctx.opad.s[6];
|
||||
tmps[gid].opad_raw[7] = streebog512_hmac_ctx.opad.s[7];
|
||||
|
||||
streebog512_hmac_update_global_swap (&streebog512_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64);
|
||||
|
||||
for (u32 i = 0, j = 1; i < 8; i += 8, j += 1)
|
||||
{
|
||||
streebog512_hmac_ctx_t streebog512_hmac_ctx2 = streebog512_hmac_ctx;
|
||||
|
||||
w0[0] = j;
|
||||
w0[1] = 0;
|
||||
w0[2] = 0;
|
||||
w0[3] = 0;
|
||||
w1[0] = 0;
|
||||
w1[1] = 0;
|
||||
w1[2] = 0;
|
||||
w1[3] = 0;
|
||||
w2[0] = 0;
|
||||
w2[1] = 0;
|
||||
w2[2] = 0;
|
||||
w2[3] = 0;
|
||||
w3[0] = 0;
|
||||
w3[1] = 0;
|
||||
w3[2] = 0;
|
||||
w3[3] = 0;
|
||||
|
||||
streebog512_hmac_update_64 (&streebog512_hmac_ctx2, w0, w1, w2, w3, 4);
|
||||
|
||||
streebog512_hmac_final (&streebog512_hmac_ctx2);
|
||||
|
||||
tmps[gid].dgst[i + 0] = streebog512_hmac_ctx2.opad.h[0];
|
||||
tmps[gid].dgst[i + 1] = streebog512_hmac_ctx2.opad.h[1];
|
||||
tmps[gid].dgst[i + 2] = streebog512_hmac_ctx2.opad.h[2];
|
||||
tmps[gid].dgst[i + 3] = streebog512_hmac_ctx2.opad.h[3];
|
||||
tmps[gid].dgst[i + 4] = streebog512_hmac_ctx2.opad.h[4];
|
||||
tmps[gid].dgst[i + 5] = streebog512_hmac_ctx2.opad.h[5];
|
||||
tmps[gid].dgst[i + 6] = streebog512_hmac_ctx2.opad.h[6];
|
||||
tmps[gid].dgst[i + 7] = streebog512_hmac_ctx2.opad.h[7];
|
||||
|
||||
tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0];
|
||||
tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1];
|
||||
tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2];
|
||||
tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3];
|
||||
tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4];
|
||||
tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5];
|
||||
tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6];
|
||||
tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7];
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m13771_loop (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global vc64_sbog_tmp_t *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 tc_t *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)
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if ((gid * VECT_SIZE) >= gid_max) return;
|
||||
|
||||
u64x ipad_hash[8];
|
||||
u64x opad_hash[8];
|
||||
|
||||
ipad_hash[0] = pack64v (tmps, ipad_hash, gid, 0);
|
||||
ipad_hash[1] = pack64v (tmps, ipad_hash, gid, 1);
|
||||
ipad_hash[2] = pack64v (tmps, ipad_hash, gid, 2);
|
||||
ipad_hash[3] = pack64v (tmps, ipad_hash, gid, 3);
|
||||
ipad_hash[4] = pack64v (tmps, ipad_hash, gid, 4);
|
||||
ipad_hash[5] = pack64v (tmps, ipad_hash, gid, 5);
|
||||
ipad_hash[6] = pack64v (tmps, ipad_hash, gid, 6);
|
||||
ipad_hash[7] = pack64v (tmps, ipad_hash, gid, 7);
|
||||
|
||||
opad_hash[0] = pack64v (tmps, opad_hash, gid, 0);
|
||||
opad_hash[1] = pack64v (tmps, opad_hash, gid, 1);
|
||||
opad_hash[2] = pack64v (tmps, opad_hash, gid, 2);
|
||||
opad_hash[3] = pack64v (tmps, opad_hash, gid, 3);
|
||||
opad_hash[4] = pack64v (tmps, opad_hash, gid, 4);
|
||||
opad_hash[5] = pack64v (tmps, opad_hash, gid, 5);
|
||||
opad_hash[6] = pack64v (tmps, opad_hash, gid, 6);
|
||||
opad_hash[7] = pack64v (tmps, opad_hash, gid, 7);
|
||||
|
||||
u64x ipad_raw[8];
|
||||
u64x opad_raw[8];
|
||||
|
||||
ipad_raw[0] = pack64v (tmps, ipad_raw, gid, 0);
|
||||
ipad_raw[1] = pack64v (tmps, ipad_raw, gid, 1);
|
||||
ipad_raw[2] = pack64v (tmps, ipad_raw, gid, 2);
|
||||
ipad_raw[3] = pack64v (tmps, ipad_raw, gid, 3);
|
||||
ipad_raw[4] = pack64v (tmps, ipad_raw, gid, 4);
|
||||
ipad_raw[5] = pack64v (tmps, ipad_raw, gid, 5);
|
||||
ipad_raw[6] = pack64v (tmps, ipad_raw, gid, 6);
|
||||
ipad_raw[7] = pack64v (tmps, ipad_raw, gid, 7);
|
||||
|
||||
opad_raw[0] = pack64v (tmps, opad_raw, gid, 0);
|
||||
opad_raw[1] = pack64v (tmps, opad_raw, gid, 1);
|
||||
opad_raw[2] = pack64v (tmps, opad_raw, gid, 2);
|
||||
opad_raw[3] = pack64v (tmps, opad_raw, gid, 3);
|
||||
opad_raw[4] = pack64v (tmps, opad_raw, gid, 4);
|
||||
opad_raw[5] = pack64v (tmps, opad_raw, gid, 5);
|
||||
opad_raw[6] = pack64v (tmps, opad_raw, gid, 6);
|
||||
opad_raw[7] = pack64v (tmps, opad_raw, gid, 7);
|
||||
|
||||
for (u32 i = 0; i < 8; i += 8)
|
||||
{
|
||||
u64x dgst[8];
|
||||
u64x out[8];
|
||||
|
||||
dgst[0] = pack64v (tmps, dgst, gid, i + 0);
|
||||
dgst[1] = pack64v (tmps, dgst, gid, i + 1);
|
||||
dgst[2] = pack64v (tmps, dgst, gid, i + 2);
|
||||
dgst[3] = pack64v (tmps, dgst, gid, i + 3);
|
||||
dgst[4] = pack64v (tmps, dgst, gid, i + 4);
|
||||
dgst[5] = pack64v (tmps, dgst, gid, i + 5);
|
||||
dgst[6] = pack64v (tmps, dgst, gid, i + 6);
|
||||
dgst[7] = pack64v (tmps, dgst, gid, i + 7);
|
||||
|
||||
out[0] = pack64v (tmps, out, gid, i + 0);
|
||||
out[1] = pack64v (tmps, out, gid, i + 1);
|
||||
out[2] = pack64v (tmps, out, gid, i + 2);
|
||||
out[3] = pack64v (tmps, out, gid, i + 3);
|
||||
out[4] = pack64v (tmps, out, gid, i + 4);
|
||||
out[5] = pack64v (tmps, out, gid, i + 5);
|
||||
out[6] = pack64v (tmps, out, gid, i + 6);
|
||||
out[7] = pack64v (tmps, out, gid, i + 7);
|
||||
|
||||
for (u32 j = 0; j < loop_cnt; j++)
|
||||
{
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = h32_from_64 (dgst[0]);
|
||||
w0[1] = l32_from_64 (dgst[0]);
|
||||
w0[2] = h32_from_64 (dgst[1]);
|
||||
w0[3] = l32_from_64 (dgst[1]);
|
||||
w1[0] = h32_from_64 (dgst[2]);
|
||||
w1[1] = l32_from_64 (dgst[2]);
|
||||
w1[2] = h32_from_64 (dgst[3]);
|
||||
w1[3] = l32_from_64 (dgst[3]);
|
||||
w2[0] = h32_from_64 (dgst[4]);
|
||||
w2[1] = l32_from_64 (dgst[4]);
|
||||
w2[2] = h32_from_64 (dgst[5]);
|
||||
w2[3] = l32_from_64 (dgst[5]);
|
||||
w3[0] = h32_from_64 (dgst[6]);
|
||||
w3[1] = l32_from_64 (dgst[6]);
|
||||
w3[2] = h32_from_64 (dgst[7]);
|
||||
w3[3] = l32_from_64 (dgst[7]);
|
||||
|
||||
hmac_streebog512_run_V (w0, w1, w2, w3, ipad_hash, opad_hash, ipad_raw, opad_raw, dgst, s_sbob_sl64);
|
||||
|
||||
out[0] ^= dgst[0];
|
||||
out[1] ^= dgst[1];
|
||||
out[2] ^= dgst[2];
|
||||
out[3] ^= dgst[3];
|
||||
out[4] ^= dgst[4];
|
||||
out[5] ^= dgst[5];
|
||||
out[6] ^= dgst[6];
|
||||
out[7] ^= dgst[7];
|
||||
}
|
||||
|
||||
unpack64v (tmps, dgst, gid, i + 0, dgst[0]);
|
||||
unpack64v (tmps, dgst, gid, i + 1, dgst[1]);
|
||||
unpack64v (tmps, dgst, gid, i + 2, dgst[2]);
|
||||
unpack64v (tmps, dgst, gid, i + 3, dgst[3]);
|
||||
unpack64v (tmps, dgst, gid, i + 4, dgst[4]);
|
||||
unpack64v (tmps, dgst, gid, i + 5, dgst[5]);
|
||||
unpack64v (tmps, dgst, gid, i + 6, dgst[6]);
|
||||
unpack64v (tmps, dgst, gid, i + 7, dgst[7]);
|
||||
|
||||
unpack64v (tmps, out, gid, i + 0, out[0]);
|
||||
unpack64v (tmps, out, gid, i + 1, out[1]);
|
||||
unpack64v (tmps, out, gid, i + 2, out[2]);
|
||||
unpack64v (tmps, out, gid, i + 3, out[3]);
|
||||
unpack64v (tmps, out, gid, i + 4, out[4]);
|
||||
unpack64v (tmps, out, gid, i + 5, out[5]);
|
||||
unpack64v (tmps, out, gid, i + 6, out[6]);
|
||||
unpack64v (tmps, out, gid, i + 7, out[7]);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m13771_comp (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global vc64_sbog_tmp_t *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 tc_t *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)
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u32 s_td0[256];
|
||||
__local u32 s_td1[256];
|
||||
__local u32 s_td2[256];
|
||||
__local u32 s_td3[256];
|
||||
__local u32 s_td4[256];
|
||||
|
||||
__local u32 s_te0[256];
|
||||
__local u32 s_te1[256];
|
||||
__local u32 s_te2[256];
|
||||
__local u32 s_te3[256];
|
||||
__local u32 s_te4[256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u32a *s_td0 = td0;
|
||||
__constant u32a *s_td1 = td1;
|
||||
__constant u32a *s_td2 = td2;
|
||||
__constant u32a *s_td3 = td3;
|
||||
__constant u32a *s_td4 = td4;
|
||||
|
||||
__constant u32a *s_te0 = te0;
|
||||
__constant u32a *s_te1 = te1;
|
||||
__constant u32a *s_te2 = te2;
|
||||
__constant u32a *s_te3 = te3;
|
||||
__constant u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 ukey1[8];
|
||||
u32 ukey2[8];
|
||||
|
||||
ukey1[0] = swap32_S (h32_from_64_S (tmps[gid].out[7]));
|
||||
ukey1[1] = swap32_S (l32_from_64_S (tmps[gid].out[7]));
|
||||
ukey1[2] = swap32_S (h32_from_64_S (tmps[gid].out[6]));
|
||||
ukey1[3] = swap32_S (l32_from_64_S (tmps[gid].out[6]));
|
||||
ukey1[4] = swap32_S (h32_from_64_S (tmps[gid].out[5]));
|
||||
ukey1[5] = swap32_S (l32_from_64_S (tmps[gid].out[5]));
|
||||
ukey1[6] = swap32_S (h32_from_64_S (tmps[gid].out[4]));
|
||||
ukey1[7] = swap32_S (l32_from_64_S (tmps[gid].out[4]));
|
||||
|
||||
ukey2[0] = swap32_S (h32_from_64_S (tmps[gid].out[3]));
|
||||
ukey2[1] = swap32_S (l32_from_64_S (tmps[gid].out[3]));
|
||||
ukey2[2] = swap32_S (h32_from_64_S (tmps[gid].out[2]));
|
||||
ukey2[3] = swap32_S (l32_from_64_S (tmps[gid].out[2]));
|
||||
ukey2[4] = swap32_S (h32_from_64_S (tmps[gid].out[1]));
|
||||
ukey2[5] = swap32_S (l32_from_64_S (tmps[gid].out[1]));
|
||||
ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[0]));
|
||||
ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[0]));
|
||||
|
||||
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
}
|
623
OpenCL/m13772-pure.cl
Normal file
623
OpenCL/m13772-pure.cl
Normal file
@ -0,0 +1,623 @@
|
||||
/**
|
||||
* 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_streebog512.cl"
|
||||
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_cipher_twofish.cl"
|
||||
#include "inc_cipher_serpent.cl"
|
||||
|
||||
#include "inc_truecrypt_crc32.cl"
|
||||
#include "inc_truecrypt_xts.cl"
|
||||
|
||||
DECLSPEC u32 u8add (const u32 a, const u32 b)
|
||||
{
|
||||
const u32 a1 = (a >> 0) & 0xff;
|
||||
const u32 a2 = (a >> 8) & 0xff;
|
||||
const u32 a3 = (a >> 16) & 0xff;
|
||||
const u32 a4 = (a >> 24) & 0xff;
|
||||
|
||||
const u32 b1 = (b >> 0) & 0xff;
|
||||
const u32 b2 = (b >> 8) & 0xff;
|
||||
const u32 b3 = (b >> 16) & 0xff;
|
||||
const u32 b4 = (b >> 24) & 0xff;
|
||||
|
||||
const u32 r1 = (a1 + b1) & 0xff;
|
||||
const u32 r2 = (a2 + b2) & 0xff;
|
||||
const u32 r3 = (a3 + b3) & 0xff;
|
||||
const u32 r4 = (a4 + b4) & 0xff;
|
||||
|
||||
const u32 r = r1 << 0
|
||||
| r2 << 8
|
||||
| r3 << 16
|
||||
| r4 << 24;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipad_hash, u64x *opad_hash, u64x *ipad_raw, u64x *opad_raw, u64x *digest, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
const u64x nullbuf[8] = { 0 };
|
||||
u64x counterbuf[8] = { 0 };
|
||||
u64x padding[8] = { 0 };
|
||||
u64x message[8];
|
||||
|
||||
padding[7] = swap64 ((u64x) 0x01);
|
||||
|
||||
//inner HMAC: ipad + message
|
||||
|
||||
//first transform: precalculated ipad hash
|
||||
counterbuf[7] = swap64 ((u64x) 0x200);
|
||||
|
||||
//second transform: message = previous HMAC digest
|
||||
message[7] = hl32_to_64 (w3[2], w3[3]);
|
||||
message[6] = hl32_to_64 (w3[0], w3[1]);
|
||||
message[5] = hl32_to_64 (w2[2], w2[3]);
|
||||
message[4] = hl32_to_64 (w2[0], w2[1]);
|
||||
message[3] = hl32_to_64 (w1[2], w1[3]);
|
||||
message[2] = hl32_to_64 (w1[0], w1[1]);
|
||||
message[1] = hl32_to_64 (w0[2], w0[3]);
|
||||
message[0] = hl32_to_64 (w0[0], w0[1]);
|
||||
|
||||
digest[0] = ipad_hash[0];
|
||||
digest[1] = ipad_hash[1];
|
||||
digest[2] = ipad_hash[2];
|
||||
digest[3] = ipad_hash[3];
|
||||
digest[4] = ipad_hash[4];
|
||||
digest[5] = ipad_hash[5];
|
||||
digest[6] = ipad_hash[6];
|
||||
digest[7] = ipad_hash[7];
|
||||
|
||||
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
|
||||
|
||||
counterbuf[7] = swap64 ((u64x) 0x400);
|
||||
|
||||
//final: padding byte
|
||||
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);
|
||||
|
||||
streebog512_add_vector (message, ipad_raw);
|
||||
streebog512_add_vector (message, padding);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, counterbuf, s_sbob_sl64);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, message, s_sbob_sl64);
|
||||
|
||||
//outer HMAC: opad + digest
|
||||
|
||||
//first transform: precalculated opad hash
|
||||
counterbuf[7] = swap64 ((u64x) 0x200);
|
||||
|
||||
//second transform: message = inner HMAC digest
|
||||
message[0] = digest[0];
|
||||
message[1] = digest[1];
|
||||
message[2] = digest[2];
|
||||
message[3] = digest[3];
|
||||
message[4] = digest[4];
|
||||
message[5] = digest[5];
|
||||
message[6] = digest[6];
|
||||
message[7] = digest[7];
|
||||
|
||||
digest[0] = opad_hash[0];
|
||||
digest[1] = opad_hash[1];
|
||||
digest[2] = opad_hash[2];
|
||||
digest[3] = opad_hash[3];
|
||||
digest[4] = opad_hash[4];
|
||||
digest[5] = opad_hash[5];
|
||||
digest[6] = opad_hash[6];
|
||||
digest[7] = opad_hash[7];
|
||||
|
||||
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
|
||||
|
||||
counterbuf[7] = swap64 ((u64x) 0x400);
|
||||
|
||||
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);
|
||||
|
||||
streebog512_add_vector (message, opad_raw);
|
||||
streebog512_add_vector (message, padding);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, counterbuf, s_sbob_sl64);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, message, s_sbob_sl64);
|
||||
}
|
||||
|
||||
__kernel void m13772_init (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global vc64_sbog_tmp_t *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 tc_t *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)
|
||||
{
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
|
||||
w0[0] = pws[gid].i[ 0];
|
||||
w0[1] = pws[gid].i[ 1];
|
||||
w0[2] = pws[gid].i[ 2];
|
||||
w0[3] = pws[gid].i[ 3];
|
||||
w1[0] = pws[gid].i[ 4];
|
||||
w1[1] = pws[gid].i[ 5];
|
||||
w1[2] = pws[gid].i[ 6];
|
||||
w1[3] = pws[gid].i[ 7];
|
||||
w2[0] = pws[gid].i[ 8];
|
||||
w2[1] = pws[gid].i[ 9];
|
||||
w2[2] = pws[gid].i[10];
|
||||
w2[3] = pws[gid].i[11];
|
||||
w3[0] = pws[gid].i[12];
|
||||
w3[1] = pws[gid].i[13];
|
||||
w3[2] = pws[gid].i[14];
|
||||
w3[3] = pws[gid].i[15];
|
||||
|
||||
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
|
||||
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);
|
||||
w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]);
|
||||
w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]);
|
||||
w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]);
|
||||
w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]);
|
||||
w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]);
|
||||
w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]);
|
||||
w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]);
|
||||
w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]);
|
||||
w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]);
|
||||
w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]);
|
||||
w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]);
|
||||
w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]);
|
||||
w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]);
|
||||
w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]);
|
||||
|
||||
w0[0] = swap32_S (w0[0]);
|
||||
w0[1] = swap32_S (w0[1]);
|
||||
w0[2] = swap32_S (w0[2]);
|
||||
w0[3] = swap32_S (w0[3]);
|
||||
w1[0] = swap32_S (w1[0]);
|
||||
w1[1] = swap32_S (w1[1]);
|
||||
w1[2] = swap32_S (w1[2]);
|
||||
w1[3] = swap32_S (w1[3]);
|
||||
w2[0] = swap32_S (w2[0]);
|
||||
w2[1] = swap32_S (w2[1]);
|
||||
w2[2] = swap32_S (w2[2]);
|
||||
w2[3] = swap32_S (w2[3]);
|
||||
w3[0] = swap32_S (w3[0]);
|
||||
w3[1] = swap32_S (w3[1]);
|
||||
w3[2] = swap32_S (w3[2]);
|
||||
w3[3] = swap32_S (w3[3]);
|
||||
|
||||
streebog512_hmac_ctx_t streebog512_hmac_ctx;
|
||||
|
||||
streebog512_hmac_init_64 (&streebog512_hmac_ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
|
||||
tmps[gid].ipad_hash[0] = streebog512_hmac_ctx.ipad.h[0];
|
||||
tmps[gid].ipad_hash[1] = streebog512_hmac_ctx.ipad.h[1];
|
||||
tmps[gid].ipad_hash[2] = streebog512_hmac_ctx.ipad.h[2];
|
||||
tmps[gid].ipad_hash[3] = streebog512_hmac_ctx.ipad.h[3];
|
||||
tmps[gid].ipad_hash[4] = streebog512_hmac_ctx.ipad.h[4];
|
||||
tmps[gid].ipad_hash[5] = streebog512_hmac_ctx.ipad.h[5];
|
||||
tmps[gid].ipad_hash[6] = streebog512_hmac_ctx.ipad.h[6];
|
||||
tmps[gid].ipad_hash[7] = streebog512_hmac_ctx.ipad.h[7];
|
||||
|
||||
tmps[gid].opad_hash[0] = streebog512_hmac_ctx.opad.h[0];
|
||||
tmps[gid].opad_hash[1] = streebog512_hmac_ctx.opad.h[1];
|
||||
tmps[gid].opad_hash[2] = streebog512_hmac_ctx.opad.h[2];
|
||||
tmps[gid].opad_hash[3] = streebog512_hmac_ctx.opad.h[3];
|
||||
tmps[gid].opad_hash[4] = streebog512_hmac_ctx.opad.h[4];
|
||||
tmps[gid].opad_hash[5] = streebog512_hmac_ctx.opad.h[5];
|
||||
tmps[gid].opad_hash[6] = streebog512_hmac_ctx.opad.h[6];
|
||||
tmps[gid].opad_hash[7] = streebog512_hmac_ctx.opad.h[7];
|
||||
|
||||
tmps[gid].ipad_raw[0] = streebog512_hmac_ctx.ipad.s[0];
|
||||
tmps[gid].ipad_raw[1] = streebog512_hmac_ctx.ipad.s[1];
|
||||
tmps[gid].ipad_raw[2] = streebog512_hmac_ctx.ipad.s[2];
|
||||
tmps[gid].ipad_raw[3] = streebog512_hmac_ctx.ipad.s[3];
|
||||
tmps[gid].ipad_raw[4] = streebog512_hmac_ctx.ipad.s[4];
|
||||
tmps[gid].ipad_raw[5] = streebog512_hmac_ctx.ipad.s[5];
|
||||
tmps[gid].ipad_raw[6] = streebog512_hmac_ctx.ipad.s[6];
|
||||
tmps[gid].ipad_raw[7] = streebog512_hmac_ctx.ipad.s[7];
|
||||
|
||||
tmps[gid].opad_raw[0] = streebog512_hmac_ctx.opad.s[0];
|
||||
tmps[gid].opad_raw[1] = streebog512_hmac_ctx.opad.s[1];
|
||||
tmps[gid].opad_raw[2] = streebog512_hmac_ctx.opad.s[2];
|
||||
tmps[gid].opad_raw[3] = streebog512_hmac_ctx.opad.s[3];
|
||||
tmps[gid].opad_raw[4] = streebog512_hmac_ctx.opad.s[4];
|
||||
tmps[gid].opad_raw[5] = streebog512_hmac_ctx.opad.s[5];
|
||||
tmps[gid].opad_raw[6] = streebog512_hmac_ctx.opad.s[6];
|
||||
tmps[gid].opad_raw[7] = streebog512_hmac_ctx.opad.s[7];
|
||||
|
||||
streebog512_hmac_update_global_swap (&streebog512_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64);
|
||||
|
||||
for (u32 i = 0, j = 1; i < 16; i += 8, j += 1)
|
||||
{
|
||||
streebog512_hmac_ctx_t streebog512_hmac_ctx2 = streebog512_hmac_ctx;
|
||||
|
||||
w0[0] = j;
|
||||
w0[1] = 0;
|
||||
w0[2] = 0;
|
||||
w0[3] = 0;
|
||||
w1[0] = 0;
|
||||
w1[1] = 0;
|
||||
w1[2] = 0;
|
||||
w1[3] = 0;
|
||||
w2[0] = 0;
|
||||
w2[1] = 0;
|
||||
w2[2] = 0;
|
||||
w2[3] = 0;
|
||||
w3[0] = 0;
|
||||
w3[1] = 0;
|
||||
w3[2] = 0;
|
||||
w3[3] = 0;
|
||||
|
||||
streebog512_hmac_update_64 (&streebog512_hmac_ctx2, w0, w1, w2, w3, 4);
|
||||
|
||||
streebog512_hmac_final (&streebog512_hmac_ctx2);
|
||||
|
||||
tmps[gid].dgst[i + 0] = streebog512_hmac_ctx2.opad.h[0];
|
||||
tmps[gid].dgst[i + 1] = streebog512_hmac_ctx2.opad.h[1];
|
||||
tmps[gid].dgst[i + 2] = streebog512_hmac_ctx2.opad.h[2];
|
||||
tmps[gid].dgst[i + 3] = streebog512_hmac_ctx2.opad.h[3];
|
||||
tmps[gid].dgst[i + 4] = streebog512_hmac_ctx2.opad.h[4];
|
||||
tmps[gid].dgst[i + 5] = streebog512_hmac_ctx2.opad.h[5];
|
||||
tmps[gid].dgst[i + 6] = streebog512_hmac_ctx2.opad.h[6];
|
||||
tmps[gid].dgst[i + 7] = streebog512_hmac_ctx2.opad.h[7];
|
||||
|
||||
tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0];
|
||||
tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1];
|
||||
tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2];
|
||||
tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3];
|
||||
tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4];
|
||||
tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5];
|
||||
tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6];
|
||||
tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7];
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m13772_loop (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global vc64_sbog_tmp_t *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 tc_t *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)
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if ((gid * VECT_SIZE) >= gid_max) return;
|
||||
|
||||
u64x ipad_hash[8];
|
||||
u64x opad_hash[8];
|
||||
|
||||
ipad_hash[0] = pack64v (tmps, ipad_hash, gid, 0);
|
||||
ipad_hash[1] = pack64v (tmps, ipad_hash, gid, 1);
|
||||
ipad_hash[2] = pack64v (tmps, ipad_hash, gid, 2);
|
||||
ipad_hash[3] = pack64v (tmps, ipad_hash, gid, 3);
|
||||
ipad_hash[4] = pack64v (tmps, ipad_hash, gid, 4);
|
||||
ipad_hash[5] = pack64v (tmps, ipad_hash, gid, 5);
|
||||
ipad_hash[6] = pack64v (tmps, ipad_hash, gid, 6);
|
||||
ipad_hash[7] = pack64v (tmps, ipad_hash, gid, 7);
|
||||
|
||||
opad_hash[0] = pack64v (tmps, opad_hash, gid, 0);
|
||||
opad_hash[1] = pack64v (tmps, opad_hash, gid, 1);
|
||||
opad_hash[2] = pack64v (tmps, opad_hash, gid, 2);
|
||||
opad_hash[3] = pack64v (tmps, opad_hash, gid, 3);
|
||||
opad_hash[4] = pack64v (tmps, opad_hash, gid, 4);
|
||||
opad_hash[5] = pack64v (tmps, opad_hash, gid, 5);
|
||||
opad_hash[6] = pack64v (tmps, opad_hash, gid, 6);
|
||||
opad_hash[7] = pack64v (tmps, opad_hash, gid, 7);
|
||||
|
||||
u64x ipad_raw[8];
|
||||
u64x opad_raw[8];
|
||||
|
||||
ipad_raw[0] = pack64v (tmps, ipad_raw, gid, 0);
|
||||
ipad_raw[1] = pack64v (tmps, ipad_raw, gid, 1);
|
||||
ipad_raw[2] = pack64v (tmps, ipad_raw, gid, 2);
|
||||
ipad_raw[3] = pack64v (tmps, ipad_raw, gid, 3);
|
||||
ipad_raw[4] = pack64v (tmps, ipad_raw, gid, 4);
|
||||
ipad_raw[5] = pack64v (tmps, ipad_raw, gid, 5);
|
||||
ipad_raw[6] = pack64v (tmps, ipad_raw, gid, 6);
|
||||
ipad_raw[7] = pack64v (tmps, ipad_raw, gid, 7);
|
||||
|
||||
opad_raw[0] = pack64v (tmps, opad_raw, gid, 0);
|
||||
opad_raw[1] = pack64v (tmps, opad_raw, gid, 1);
|
||||
opad_raw[2] = pack64v (tmps, opad_raw, gid, 2);
|
||||
opad_raw[3] = pack64v (tmps, opad_raw, gid, 3);
|
||||
opad_raw[4] = pack64v (tmps, opad_raw, gid, 4);
|
||||
opad_raw[5] = pack64v (tmps, opad_raw, gid, 5);
|
||||
opad_raw[6] = pack64v (tmps, opad_raw, gid, 6);
|
||||
opad_raw[7] = pack64v (tmps, opad_raw, gid, 7);
|
||||
|
||||
for (u32 i = 0; i < 16; i += 8)
|
||||
{
|
||||
u64x dgst[8];
|
||||
u64x out[8];
|
||||
|
||||
dgst[0] = pack64v (tmps, dgst, gid, i + 0);
|
||||
dgst[1] = pack64v (tmps, dgst, gid, i + 1);
|
||||
dgst[2] = pack64v (tmps, dgst, gid, i + 2);
|
||||
dgst[3] = pack64v (tmps, dgst, gid, i + 3);
|
||||
dgst[4] = pack64v (tmps, dgst, gid, i + 4);
|
||||
dgst[5] = pack64v (tmps, dgst, gid, i + 5);
|
||||
dgst[6] = pack64v (tmps, dgst, gid, i + 6);
|
||||
dgst[7] = pack64v (tmps, dgst, gid, i + 7);
|
||||
|
||||
out[0] = pack64v (tmps, out, gid, i + 0);
|
||||
out[1] = pack64v (tmps, out, gid, i + 1);
|
||||
out[2] = pack64v (tmps, out, gid, i + 2);
|
||||
out[3] = pack64v (tmps, out, gid, i + 3);
|
||||
out[4] = pack64v (tmps, out, gid, i + 4);
|
||||
out[5] = pack64v (tmps, out, gid, i + 5);
|
||||
out[6] = pack64v (tmps, out, gid, i + 6);
|
||||
out[7] = pack64v (tmps, out, gid, i + 7);
|
||||
|
||||
for (u32 j = 0; j < loop_cnt; j++)
|
||||
{
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = h32_from_64 (dgst[0]);
|
||||
w0[1] = l32_from_64 (dgst[0]);
|
||||
w0[2] = h32_from_64 (dgst[1]);
|
||||
w0[3] = l32_from_64 (dgst[1]);
|
||||
w1[0] = h32_from_64 (dgst[2]);
|
||||
w1[1] = l32_from_64 (dgst[2]);
|
||||
w1[2] = h32_from_64 (dgst[3]);
|
||||
w1[3] = l32_from_64 (dgst[3]);
|
||||
w2[0] = h32_from_64 (dgst[4]);
|
||||
w2[1] = l32_from_64 (dgst[4]);
|
||||
w2[2] = h32_from_64 (dgst[5]);
|
||||
w2[3] = l32_from_64 (dgst[5]);
|
||||
w3[0] = h32_from_64 (dgst[6]);
|
||||
w3[1] = l32_from_64 (dgst[6]);
|
||||
w3[2] = h32_from_64 (dgst[7]);
|
||||
w3[3] = l32_from_64 (dgst[7]);
|
||||
|
||||
hmac_streebog512_run_V (w0, w1, w2, w3, ipad_hash, opad_hash, ipad_raw, opad_raw, dgst, s_sbob_sl64);
|
||||
|
||||
out[0] ^= dgst[0];
|
||||
out[1] ^= dgst[1];
|
||||
out[2] ^= dgst[2];
|
||||
out[3] ^= dgst[3];
|
||||
out[4] ^= dgst[4];
|
||||
out[5] ^= dgst[5];
|
||||
out[6] ^= dgst[6];
|
||||
out[7] ^= dgst[7];
|
||||
}
|
||||
|
||||
unpack64v (tmps, dgst, gid, i + 0, dgst[0]);
|
||||
unpack64v (tmps, dgst, gid, i + 1, dgst[1]);
|
||||
unpack64v (tmps, dgst, gid, i + 2, dgst[2]);
|
||||
unpack64v (tmps, dgst, gid, i + 3, dgst[3]);
|
||||
unpack64v (tmps, dgst, gid, i + 4, dgst[4]);
|
||||
unpack64v (tmps, dgst, gid, i + 5, dgst[5]);
|
||||
unpack64v (tmps, dgst, gid, i + 6, dgst[6]);
|
||||
unpack64v (tmps, dgst, gid, i + 7, dgst[7]);
|
||||
|
||||
unpack64v (tmps, out, gid, i + 0, out[0]);
|
||||
unpack64v (tmps, out, gid, i + 1, out[1]);
|
||||
unpack64v (tmps, out, gid, i + 2, out[2]);
|
||||
unpack64v (tmps, out, gid, i + 3, out[3]);
|
||||
unpack64v (tmps, out, gid, i + 4, out[4]);
|
||||
unpack64v (tmps, out, gid, i + 5, out[5]);
|
||||
unpack64v (tmps, out, gid, i + 6, out[6]);
|
||||
unpack64v (tmps, out, gid, i + 7, out[7]);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m13772_comp (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global vc64_sbog_tmp_t *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 tc_t *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)
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u32 s_td0[256];
|
||||
__local u32 s_td1[256];
|
||||
__local u32 s_td2[256];
|
||||
__local u32 s_td3[256];
|
||||
__local u32 s_td4[256];
|
||||
|
||||
__local u32 s_te0[256];
|
||||
__local u32 s_te1[256];
|
||||
__local u32 s_te2[256];
|
||||
__local u32 s_te3[256];
|
||||
__local u32 s_te4[256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u32a *s_td0 = td0;
|
||||
__constant u32a *s_td1 = td1;
|
||||
__constant u32a *s_td2 = td2;
|
||||
__constant u32a *s_td3 = td3;
|
||||
__constant u32a *s_td4 = td4;
|
||||
|
||||
__constant u32a *s_te0 = te0;
|
||||
__constant u32a *s_te1 = te1;
|
||||
__constant u32a *s_te2 = te2;
|
||||
__constant u32a *s_te3 = te3;
|
||||
__constant u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 ukey1[8];
|
||||
|
||||
ukey1[0] = swap32_S (h32_from_64_S (tmps[gid].out[7]));
|
||||
ukey1[1] = swap32_S (l32_from_64_S (tmps[gid].out[7]));
|
||||
ukey1[2] = swap32_S (h32_from_64_S (tmps[gid].out[6]));
|
||||
ukey1[3] = swap32_S (l32_from_64_S (tmps[gid].out[6]));
|
||||
ukey1[4] = swap32_S (h32_from_64_S (tmps[gid].out[5]));
|
||||
ukey1[5] = swap32_S (l32_from_64_S (tmps[gid].out[5]));
|
||||
ukey1[6] = swap32_S (h32_from_64_S (tmps[gid].out[4]));
|
||||
ukey1[7] = swap32_S (l32_from_64_S (tmps[gid].out[4]));
|
||||
|
||||
u32 ukey2[8];
|
||||
|
||||
ukey2[0] = swap32_S (h32_from_64_S (tmps[gid].out[3]));
|
||||
ukey2[1] = swap32_S (l32_from_64_S (tmps[gid].out[3]));
|
||||
ukey2[2] = swap32_S (h32_from_64_S (tmps[gid].out[2]));
|
||||
ukey2[3] = swap32_S (l32_from_64_S (tmps[gid].out[2]));
|
||||
ukey2[4] = swap32_S (h32_from_64_S (tmps[gid].out[1]));
|
||||
ukey2[5] = swap32_S (l32_from_64_S (tmps[gid].out[1]));
|
||||
ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[0]));
|
||||
ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[0]));
|
||||
|
||||
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
u32 ukey3[8];
|
||||
|
||||
ukey3[0] = swap32_S (h32_from_64_S (tmps[gid].out[15]));
|
||||
ukey3[1] = swap32_S (l32_from_64_S (tmps[gid].out[15]));
|
||||
ukey3[2] = swap32_S (h32_from_64_S (tmps[gid].out[14]));
|
||||
ukey3[3] = swap32_S (l32_from_64_S (tmps[gid].out[14]));
|
||||
ukey3[4] = swap32_S (h32_from_64_S (tmps[gid].out[13]));
|
||||
ukey3[5] = swap32_S (l32_from_64_S (tmps[gid].out[13]));
|
||||
ukey3[6] = swap32_S (h32_from_64_S (tmps[gid].out[12]));
|
||||
ukey3[7] = swap32_S (l32_from_64_S (tmps[gid].out[12]));
|
||||
|
||||
u32 ukey4[8];
|
||||
|
||||
ukey4[0] = swap32_S (h32_from_64_S (tmps[gid].out[11]));
|
||||
ukey4[1] = swap32_S (l32_from_64_S (tmps[gid].out[11]));
|
||||
ukey4[2] = swap32_S (h32_from_64_S (tmps[gid].out[10]));
|
||||
ukey4[3] = swap32_S (l32_from_64_S (tmps[gid].out[10]));
|
||||
ukey4[4] = swap32_S (h32_from_64_S (tmps[gid].out[ 9]));
|
||||
ukey4[5] = swap32_S (l32_from_64_S (tmps[gid].out[ 9]));
|
||||
ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[ 8]));
|
||||
ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[ 8]));
|
||||
|
||||
if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
}
|
661
OpenCL/m13773-pure.cl
Normal file
661
OpenCL/m13773-pure.cl
Normal file
@ -0,0 +1,661 @@
|
||||
/**
|
||||
* 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_streebog512.cl"
|
||||
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_cipher_twofish.cl"
|
||||
#include "inc_cipher_serpent.cl"
|
||||
|
||||
#include "inc_truecrypt_crc32.cl"
|
||||
#include "inc_truecrypt_xts.cl"
|
||||
|
||||
DECLSPEC u32 u8add (const u32 a, const u32 b)
|
||||
{
|
||||
const u32 a1 = (a >> 0) & 0xff;
|
||||
const u32 a2 = (a >> 8) & 0xff;
|
||||
const u32 a3 = (a >> 16) & 0xff;
|
||||
const u32 a4 = (a >> 24) & 0xff;
|
||||
|
||||
const u32 b1 = (b >> 0) & 0xff;
|
||||
const u32 b2 = (b >> 8) & 0xff;
|
||||
const u32 b3 = (b >> 16) & 0xff;
|
||||
const u32 b4 = (b >> 24) & 0xff;
|
||||
|
||||
const u32 r1 = (a1 + b1) & 0xff;
|
||||
const u32 r2 = (a2 + b2) & 0xff;
|
||||
const u32 r3 = (a3 + b3) & 0xff;
|
||||
const u32 r4 = (a4 + b4) & 0xff;
|
||||
|
||||
const u32 r = r1 << 0
|
||||
| r2 << 8
|
||||
| r3 << 16
|
||||
| r4 << 24;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
DECLSPEC void hmac_streebog512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u64x *ipad_hash, u64x *opad_hash, u64x *ipad_raw, u64x *opad_raw, u64x *digest, SHM_TYPE u64a (*s_sbob_sl64)[256])
|
||||
{
|
||||
const u64x nullbuf[8] = { 0 };
|
||||
u64x counterbuf[8] = { 0 };
|
||||
u64x padding[8] = { 0 };
|
||||
u64x message[8];
|
||||
|
||||
padding[7] = swap64 ((u64x) 0x01);
|
||||
|
||||
//inner HMAC: ipad + message
|
||||
|
||||
//first transform: precalculated ipad hash
|
||||
counterbuf[7] = swap64 ((u64x) 0x200);
|
||||
|
||||
//second transform: message = previous HMAC digest
|
||||
message[7] = hl32_to_64 (w3[2], w3[3]);
|
||||
message[6] = hl32_to_64 (w3[0], w3[1]);
|
||||
message[5] = hl32_to_64 (w2[2], w2[3]);
|
||||
message[4] = hl32_to_64 (w2[0], w2[1]);
|
||||
message[3] = hl32_to_64 (w1[2], w1[3]);
|
||||
message[2] = hl32_to_64 (w1[0], w1[1]);
|
||||
message[1] = hl32_to_64 (w0[2], w0[3]);
|
||||
message[0] = hl32_to_64 (w0[0], w0[1]);
|
||||
|
||||
digest[0] = ipad_hash[0];
|
||||
digest[1] = ipad_hash[1];
|
||||
digest[2] = ipad_hash[2];
|
||||
digest[3] = ipad_hash[3];
|
||||
digest[4] = ipad_hash[4];
|
||||
digest[5] = ipad_hash[5];
|
||||
digest[6] = ipad_hash[6];
|
||||
digest[7] = ipad_hash[7];
|
||||
|
||||
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
|
||||
|
||||
counterbuf[7] = swap64 ((u64x) 0x400);
|
||||
|
||||
//final: padding byte
|
||||
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);
|
||||
|
||||
streebog512_add_vector (message, ipad_raw);
|
||||
streebog512_add_vector (message, padding);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, counterbuf, s_sbob_sl64);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, message, s_sbob_sl64);
|
||||
|
||||
//outer HMAC: opad + digest
|
||||
|
||||
//first transform: precalculated opad hash
|
||||
counterbuf[7] = swap64 ((u64x) 0x200);
|
||||
|
||||
//second transform: message = inner HMAC digest
|
||||
message[0] = digest[0];
|
||||
message[1] = digest[1];
|
||||
message[2] = digest[2];
|
||||
message[3] = digest[3];
|
||||
message[4] = digest[4];
|
||||
message[5] = digest[5];
|
||||
message[6] = digest[6];
|
||||
message[7] = digest[7];
|
||||
|
||||
digest[0] = opad_hash[0];
|
||||
digest[1] = opad_hash[1];
|
||||
digest[2] = opad_hash[2];
|
||||
digest[3] = opad_hash[3];
|
||||
digest[4] = opad_hash[4];
|
||||
digest[5] = opad_hash[5];
|
||||
digest[6] = opad_hash[6];
|
||||
digest[7] = opad_hash[7];
|
||||
|
||||
streebog512_g_vector (digest, counterbuf, message, s_sbob_sl64);
|
||||
|
||||
counterbuf[7] = swap64 ((u64x) 0x400);
|
||||
|
||||
streebog512_g_vector (digest, counterbuf, padding, s_sbob_sl64);
|
||||
|
||||
streebog512_add_vector (message, opad_raw);
|
||||
streebog512_add_vector (message, padding);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, counterbuf, s_sbob_sl64);
|
||||
|
||||
streebog512_g_vector (digest, nullbuf, message, s_sbob_sl64);
|
||||
}
|
||||
|
||||
__kernel void m13773_init (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global vc64_sbog_tmp_t *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 tc_t *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)
|
||||
{
|
||||
/**
|
||||
* base
|
||||
*/
|
||||
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 w0[4];
|
||||
u32 w1[4];
|
||||
u32 w2[4];
|
||||
u32 w3[4];
|
||||
|
||||
w0[0] = pws[gid].i[ 0];
|
||||
w0[1] = pws[gid].i[ 1];
|
||||
w0[2] = pws[gid].i[ 2];
|
||||
w0[3] = pws[gid].i[ 3];
|
||||
w1[0] = pws[gid].i[ 4];
|
||||
w1[1] = pws[gid].i[ 5];
|
||||
w1[2] = pws[gid].i[ 6];
|
||||
w1[3] = pws[gid].i[ 7];
|
||||
w2[0] = pws[gid].i[ 8];
|
||||
w2[1] = pws[gid].i[ 9];
|
||||
w2[2] = pws[gid].i[10];
|
||||
w2[3] = pws[gid].i[11];
|
||||
w3[0] = pws[gid].i[12];
|
||||
w3[1] = pws[gid].i[13];
|
||||
w3[2] = pws[gid].i[14];
|
||||
w3[3] = pws[gid].i[15];
|
||||
|
||||
w0[0] = u8add (w0[0], esalt_bufs[digests_offset].keyfile_buf[ 0]);
|
||||
w0[1] = u8add (w0[1], esalt_bufs[digests_offset].keyfile_buf[ 1]);
|
||||
w0[2] = u8add (w0[2], esalt_bufs[digests_offset].keyfile_buf[ 2]);
|
||||
w0[3] = u8add (w0[3], esalt_bufs[digests_offset].keyfile_buf[ 3]);
|
||||
w1[0] = u8add (w1[0], esalt_bufs[digests_offset].keyfile_buf[ 4]);
|
||||
w1[1] = u8add (w1[1], esalt_bufs[digests_offset].keyfile_buf[ 5]);
|
||||
w1[2] = u8add (w1[2], esalt_bufs[digests_offset].keyfile_buf[ 6]);
|
||||
w1[3] = u8add (w1[3], esalt_bufs[digests_offset].keyfile_buf[ 7]);
|
||||
w2[0] = u8add (w2[0], esalt_bufs[digests_offset].keyfile_buf[ 8]);
|
||||
w2[1] = u8add (w2[1], esalt_bufs[digests_offset].keyfile_buf[ 9]);
|
||||
w2[2] = u8add (w2[2], esalt_bufs[digests_offset].keyfile_buf[10]);
|
||||
w2[3] = u8add (w2[3], esalt_bufs[digests_offset].keyfile_buf[11]);
|
||||
w3[0] = u8add (w3[0], esalt_bufs[digests_offset].keyfile_buf[12]);
|
||||
w3[1] = u8add (w3[1], esalt_bufs[digests_offset].keyfile_buf[13]);
|
||||
w3[2] = u8add (w3[2], esalt_bufs[digests_offset].keyfile_buf[14]);
|
||||
w3[3] = u8add (w3[3], esalt_bufs[digests_offset].keyfile_buf[15]);
|
||||
|
||||
w0[0] = swap32_S (w0[0]);
|
||||
w0[1] = swap32_S (w0[1]);
|
||||
w0[2] = swap32_S (w0[2]);
|
||||
w0[3] = swap32_S (w0[3]);
|
||||
w1[0] = swap32_S (w1[0]);
|
||||
w1[1] = swap32_S (w1[1]);
|
||||
w1[2] = swap32_S (w1[2]);
|
||||
w1[3] = swap32_S (w1[3]);
|
||||
w2[0] = swap32_S (w2[0]);
|
||||
w2[1] = swap32_S (w2[1]);
|
||||
w2[2] = swap32_S (w2[2]);
|
||||
w2[3] = swap32_S (w2[3]);
|
||||
w3[0] = swap32_S (w3[0]);
|
||||
w3[1] = swap32_S (w3[1]);
|
||||
w3[2] = swap32_S (w3[2]);
|
||||
w3[3] = swap32_S (w3[3]);
|
||||
|
||||
streebog512_hmac_ctx_t streebog512_hmac_ctx;
|
||||
|
||||
streebog512_hmac_init_64 (&streebog512_hmac_ctx, w0, w1, w2, w3, s_sbob_sl64);
|
||||
|
||||
tmps[gid].ipad_hash[0] = streebog512_hmac_ctx.ipad.h[0];
|
||||
tmps[gid].ipad_hash[1] = streebog512_hmac_ctx.ipad.h[1];
|
||||
tmps[gid].ipad_hash[2] = streebog512_hmac_ctx.ipad.h[2];
|
||||
tmps[gid].ipad_hash[3] = streebog512_hmac_ctx.ipad.h[3];
|
||||
tmps[gid].ipad_hash[4] = streebog512_hmac_ctx.ipad.h[4];
|
||||
tmps[gid].ipad_hash[5] = streebog512_hmac_ctx.ipad.h[5];
|
||||
tmps[gid].ipad_hash[6] = streebog512_hmac_ctx.ipad.h[6];
|
||||
tmps[gid].ipad_hash[7] = streebog512_hmac_ctx.ipad.h[7];
|
||||
|
||||
tmps[gid].opad_hash[0] = streebog512_hmac_ctx.opad.h[0];
|
||||
tmps[gid].opad_hash[1] = streebog512_hmac_ctx.opad.h[1];
|
||||
tmps[gid].opad_hash[2] = streebog512_hmac_ctx.opad.h[2];
|
||||
tmps[gid].opad_hash[3] = streebog512_hmac_ctx.opad.h[3];
|
||||
tmps[gid].opad_hash[4] = streebog512_hmac_ctx.opad.h[4];
|
||||
tmps[gid].opad_hash[5] = streebog512_hmac_ctx.opad.h[5];
|
||||
tmps[gid].opad_hash[6] = streebog512_hmac_ctx.opad.h[6];
|
||||
tmps[gid].opad_hash[7] = streebog512_hmac_ctx.opad.h[7];
|
||||
|
||||
tmps[gid].ipad_raw[0] = streebog512_hmac_ctx.ipad.s[0];
|
||||
tmps[gid].ipad_raw[1] = streebog512_hmac_ctx.ipad.s[1];
|
||||
tmps[gid].ipad_raw[2] = streebog512_hmac_ctx.ipad.s[2];
|
||||
tmps[gid].ipad_raw[3] = streebog512_hmac_ctx.ipad.s[3];
|
||||
tmps[gid].ipad_raw[4] = streebog512_hmac_ctx.ipad.s[4];
|
||||
tmps[gid].ipad_raw[5] = streebog512_hmac_ctx.ipad.s[5];
|
||||
tmps[gid].ipad_raw[6] = streebog512_hmac_ctx.ipad.s[6];
|
||||
tmps[gid].ipad_raw[7] = streebog512_hmac_ctx.ipad.s[7];
|
||||
|
||||
tmps[gid].opad_raw[0] = streebog512_hmac_ctx.opad.s[0];
|
||||
tmps[gid].opad_raw[1] = streebog512_hmac_ctx.opad.s[1];
|
||||
tmps[gid].opad_raw[2] = streebog512_hmac_ctx.opad.s[2];
|
||||
tmps[gid].opad_raw[3] = streebog512_hmac_ctx.opad.s[3];
|
||||
tmps[gid].opad_raw[4] = streebog512_hmac_ctx.opad.s[4];
|
||||
tmps[gid].opad_raw[5] = streebog512_hmac_ctx.opad.s[5];
|
||||
tmps[gid].opad_raw[6] = streebog512_hmac_ctx.opad.s[6];
|
||||
tmps[gid].opad_raw[7] = streebog512_hmac_ctx.opad.s[7];
|
||||
|
||||
streebog512_hmac_update_global_swap (&streebog512_hmac_ctx, esalt_bufs[digests_offset].salt_buf, 64);
|
||||
|
||||
for (u32 i = 0, j = 1; i < 24; i += 8, j += 1)
|
||||
{
|
||||
streebog512_hmac_ctx_t streebog512_hmac_ctx2 = streebog512_hmac_ctx;
|
||||
|
||||
w0[0] = j;
|
||||
w0[1] = 0;
|
||||
w0[2] = 0;
|
||||
w0[3] = 0;
|
||||
w1[0] = 0;
|
||||
w1[1] = 0;
|
||||
w1[2] = 0;
|
||||
w1[3] = 0;
|
||||
w2[0] = 0;
|
||||
w2[1] = 0;
|
||||
w2[2] = 0;
|
||||
w2[3] = 0;
|
||||
w3[0] = 0;
|
||||
w3[1] = 0;
|
||||
w3[2] = 0;
|
||||
w3[3] = 0;
|
||||
|
||||
streebog512_hmac_update_64 (&streebog512_hmac_ctx2, w0, w1, w2, w3, 4);
|
||||
|
||||
streebog512_hmac_final (&streebog512_hmac_ctx2);
|
||||
|
||||
tmps[gid].dgst[i + 0] = streebog512_hmac_ctx2.opad.h[0];
|
||||
tmps[gid].dgst[i + 1] = streebog512_hmac_ctx2.opad.h[1];
|
||||
tmps[gid].dgst[i + 2] = streebog512_hmac_ctx2.opad.h[2];
|
||||
tmps[gid].dgst[i + 3] = streebog512_hmac_ctx2.opad.h[3];
|
||||
tmps[gid].dgst[i + 4] = streebog512_hmac_ctx2.opad.h[4];
|
||||
tmps[gid].dgst[i + 5] = streebog512_hmac_ctx2.opad.h[5];
|
||||
tmps[gid].dgst[i + 6] = streebog512_hmac_ctx2.opad.h[6];
|
||||
tmps[gid].dgst[i + 7] = streebog512_hmac_ctx2.opad.h[7];
|
||||
|
||||
tmps[gid].out[i + 0] = tmps[gid].dgst[i + 0];
|
||||
tmps[gid].out[i + 1] = tmps[gid].dgst[i + 1];
|
||||
tmps[gid].out[i + 2] = tmps[gid].dgst[i + 2];
|
||||
tmps[gid].out[i + 3] = tmps[gid].dgst[i + 3];
|
||||
tmps[gid].out[i + 4] = tmps[gid].dgst[i + 4];
|
||||
tmps[gid].out[i + 5] = tmps[gid].dgst[i + 5];
|
||||
tmps[gid].out[i + 6] = tmps[gid].dgst[i + 6];
|
||||
tmps[gid].out[i + 7] = tmps[gid].dgst[i + 7];
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m13773_loop (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global vc64_sbog_tmp_t *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 tc_t *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)
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* shared lookup table
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u64a s_sbob_sl64[8][256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_sbob_sl64[0][i] = sbob_sl64[0][i];
|
||||
s_sbob_sl64[1][i] = sbob_sl64[1][i];
|
||||
s_sbob_sl64[2][i] = sbob_sl64[2][i];
|
||||
s_sbob_sl64[3][i] = sbob_sl64[3][i];
|
||||
s_sbob_sl64[4][i] = sbob_sl64[4][i];
|
||||
s_sbob_sl64[5][i] = sbob_sl64[5][i];
|
||||
s_sbob_sl64[6][i] = sbob_sl64[6][i];
|
||||
s_sbob_sl64[7][i] = sbob_sl64[7][i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u64a (*s_sbob_sl64)[256] = sbob_sl64;
|
||||
|
||||
#endif
|
||||
|
||||
if ((gid * VECT_SIZE) >= gid_max) return;
|
||||
|
||||
u64x ipad_hash[8];
|
||||
u64x opad_hash[8];
|
||||
|
||||
ipad_hash[0] = pack64v (tmps, ipad_hash, gid, 0);
|
||||
ipad_hash[1] = pack64v (tmps, ipad_hash, gid, 1);
|
||||
ipad_hash[2] = pack64v (tmps, ipad_hash, gid, 2);
|
||||
ipad_hash[3] = pack64v (tmps, ipad_hash, gid, 3);
|
||||
ipad_hash[4] = pack64v (tmps, ipad_hash, gid, 4);
|
||||
ipad_hash[5] = pack64v (tmps, ipad_hash, gid, 5);
|
||||
ipad_hash[6] = pack64v (tmps, ipad_hash, gid, 6);
|
||||
ipad_hash[7] = pack64v (tmps, ipad_hash, gid, 7);
|
||||
|
||||
opad_hash[0] = pack64v (tmps, opad_hash, gid, 0);
|
||||
opad_hash[1] = pack64v (tmps, opad_hash, gid, 1);
|
||||
opad_hash[2] = pack64v (tmps, opad_hash, gid, 2);
|
||||
opad_hash[3] = pack64v (tmps, opad_hash, gid, 3);
|
||||
opad_hash[4] = pack64v (tmps, opad_hash, gid, 4);
|
||||
opad_hash[5] = pack64v (tmps, opad_hash, gid, 5);
|
||||
opad_hash[6] = pack64v (tmps, opad_hash, gid, 6);
|
||||
opad_hash[7] = pack64v (tmps, opad_hash, gid, 7);
|
||||
|
||||
u64x ipad_raw[8];
|
||||
u64x opad_raw[8];
|
||||
|
||||
ipad_raw[0] = pack64v (tmps, ipad_raw, gid, 0);
|
||||
ipad_raw[1] = pack64v (tmps, ipad_raw, gid, 1);
|
||||
ipad_raw[2] = pack64v (tmps, ipad_raw, gid, 2);
|
||||
ipad_raw[3] = pack64v (tmps, ipad_raw, gid, 3);
|
||||
ipad_raw[4] = pack64v (tmps, ipad_raw, gid, 4);
|
||||
ipad_raw[5] = pack64v (tmps, ipad_raw, gid, 5);
|
||||
ipad_raw[6] = pack64v (tmps, ipad_raw, gid, 6);
|
||||
ipad_raw[7] = pack64v (tmps, ipad_raw, gid, 7);
|
||||
|
||||
opad_raw[0] = pack64v (tmps, opad_raw, gid, 0);
|
||||
opad_raw[1] = pack64v (tmps, opad_raw, gid, 1);
|
||||
opad_raw[2] = pack64v (tmps, opad_raw, gid, 2);
|
||||
opad_raw[3] = pack64v (tmps, opad_raw, gid, 3);
|
||||
opad_raw[4] = pack64v (tmps, opad_raw, gid, 4);
|
||||
opad_raw[5] = pack64v (tmps, opad_raw, gid, 5);
|
||||
opad_raw[6] = pack64v (tmps, opad_raw, gid, 6);
|
||||
opad_raw[7] = pack64v (tmps, opad_raw, gid, 7);
|
||||
|
||||
for (u32 i = 0; i < 24; i += 8)
|
||||
{
|
||||
u64x dgst[8];
|
||||
u64x out[8];
|
||||
|
||||
dgst[0] = pack64v (tmps, dgst, gid, i + 0);
|
||||
dgst[1] = pack64v (tmps, dgst, gid, i + 1);
|
||||
dgst[2] = pack64v (tmps, dgst, gid, i + 2);
|
||||
dgst[3] = pack64v (tmps, dgst, gid, i + 3);
|
||||
dgst[4] = pack64v (tmps, dgst, gid, i + 4);
|
||||
dgst[5] = pack64v (tmps, dgst, gid, i + 5);
|
||||
dgst[6] = pack64v (tmps, dgst, gid, i + 6);
|
||||
dgst[7] = pack64v (tmps, dgst, gid, i + 7);
|
||||
|
||||
out[0] = pack64v (tmps, out, gid, i + 0);
|
||||
out[1] = pack64v (tmps, out, gid, i + 1);
|
||||
out[2] = pack64v (tmps, out, gid, i + 2);
|
||||
out[3] = pack64v (tmps, out, gid, i + 3);
|
||||
out[4] = pack64v (tmps, out, gid, i + 4);
|
||||
out[5] = pack64v (tmps, out, gid, i + 5);
|
||||
out[6] = pack64v (tmps, out, gid, i + 6);
|
||||
out[7] = pack64v (tmps, out, gid, i + 7);
|
||||
|
||||
for (u32 j = 0; j < loop_cnt; j++)
|
||||
{
|
||||
u32x w0[4];
|
||||
u32x w1[4];
|
||||
u32x w2[4];
|
||||
u32x w3[4];
|
||||
|
||||
w0[0] = h32_from_64 (dgst[0]);
|
||||
w0[1] = l32_from_64 (dgst[0]);
|
||||
w0[2] = h32_from_64 (dgst[1]);
|
||||
w0[3] = l32_from_64 (dgst[1]);
|
||||
w1[0] = h32_from_64 (dgst[2]);
|
||||
w1[1] = l32_from_64 (dgst[2]);
|
||||
w1[2] = h32_from_64 (dgst[3]);
|
||||
w1[3] = l32_from_64 (dgst[3]);
|
||||
w2[0] = h32_from_64 (dgst[4]);
|
||||
w2[1] = l32_from_64 (dgst[4]);
|
||||
w2[2] = h32_from_64 (dgst[5]);
|
||||
w2[3] = l32_from_64 (dgst[5]);
|
||||
w3[0] = h32_from_64 (dgst[6]);
|
||||
w3[1] = l32_from_64 (dgst[6]);
|
||||
w3[2] = h32_from_64 (dgst[7]);
|
||||
w3[3] = l32_from_64 (dgst[7]);
|
||||
|
||||
hmac_streebog512_run_V (w0, w1, w2, w3, ipad_hash, opad_hash, ipad_raw, opad_raw, dgst, s_sbob_sl64);
|
||||
|
||||
out[0] ^= dgst[0];
|
||||
out[1] ^= dgst[1];
|
||||
out[2] ^= dgst[2];
|
||||
out[3] ^= dgst[3];
|
||||
out[4] ^= dgst[4];
|
||||
out[5] ^= dgst[5];
|
||||
out[6] ^= dgst[6];
|
||||
out[7] ^= dgst[7];
|
||||
}
|
||||
|
||||
unpack64v (tmps, dgst, gid, i + 0, dgst[0]);
|
||||
unpack64v (tmps, dgst, gid, i + 1, dgst[1]);
|
||||
unpack64v (tmps, dgst, gid, i + 2, dgst[2]);
|
||||
unpack64v (tmps, dgst, gid, i + 3, dgst[3]);
|
||||
unpack64v (tmps, dgst, gid, i + 4, dgst[4]);
|
||||
unpack64v (tmps, dgst, gid, i + 5, dgst[5]);
|
||||
unpack64v (tmps, dgst, gid, i + 6, dgst[6]);
|
||||
unpack64v (tmps, dgst, gid, i + 7, dgst[7]);
|
||||
|
||||
unpack64v (tmps, out, gid, i + 0, out[0]);
|
||||
unpack64v (tmps, out, gid, i + 1, out[1]);
|
||||
unpack64v (tmps, out, gid, i + 2, out[2]);
|
||||
unpack64v (tmps, out, gid, i + 3, out[3]);
|
||||
unpack64v (tmps, out, gid, i + 4, out[4]);
|
||||
unpack64v (tmps, out, gid, i + 5, out[5]);
|
||||
unpack64v (tmps, out, gid, i + 6, out[6]);
|
||||
unpack64v (tmps, out, gid, i + 7, out[7]);
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void m13773_comp (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global vc64_sbog_tmp_t *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 tc_t *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)
|
||||
{
|
||||
const u64 gid = get_global_id (0);
|
||||
const u64 lid = get_local_id (0);
|
||||
const u64 lsz = get_local_size (0);
|
||||
|
||||
/**
|
||||
* aes shared
|
||||
*/
|
||||
|
||||
#ifdef REAL_SHM
|
||||
|
||||
__local u32 s_td0[256];
|
||||
__local u32 s_td1[256];
|
||||
__local u32 s_td2[256];
|
||||
__local u32 s_td3[256];
|
||||
__local u32 s_td4[256];
|
||||
|
||||
__local u32 s_te0[256];
|
||||
__local u32 s_te1[256];
|
||||
__local u32 s_te2[256];
|
||||
__local u32 s_te3[256];
|
||||
__local u32 s_te4[256];
|
||||
|
||||
for (MAYBE_VOLATILE u32 i = lid; i < 256; i += lsz)
|
||||
{
|
||||
s_td0[i] = td0[i];
|
||||
s_td1[i] = td1[i];
|
||||
s_td2[i] = td2[i];
|
||||
s_td3[i] = td3[i];
|
||||
s_td4[i] = td4[i];
|
||||
|
||||
s_te0[i] = te0[i];
|
||||
s_te1[i] = te1[i];
|
||||
s_te2[i] = te2[i];
|
||||
s_te3[i] = te3[i];
|
||||
s_te4[i] = te4[i];
|
||||
}
|
||||
|
||||
barrier (CLK_LOCAL_MEM_FENCE);
|
||||
|
||||
#else
|
||||
|
||||
__constant u32a *s_td0 = td0;
|
||||
__constant u32a *s_td1 = td1;
|
||||
__constant u32a *s_td2 = td2;
|
||||
__constant u32a *s_td3 = td3;
|
||||
__constant u32a *s_td4 = td4;
|
||||
|
||||
__constant u32a *s_te0 = te0;
|
||||
__constant u32a *s_te1 = te1;
|
||||
__constant u32a *s_te2 = te2;
|
||||
__constant u32a *s_te3 = te3;
|
||||
__constant u32a *s_te4 = te4;
|
||||
|
||||
#endif
|
||||
|
||||
if (gid >= gid_max) return;
|
||||
|
||||
u32 ukey1[8];
|
||||
|
||||
ukey1[0] = swap32_S (h32_from_64_S (tmps[gid].out[7]));
|
||||
ukey1[1] = swap32_S (l32_from_64_S (tmps[gid].out[7]));
|
||||
ukey1[2] = swap32_S (h32_from_64_S (tmps[gid].out[6]));
|
||||
ukey1[3] = swap32_S (l32_from_64_S (tmps[gid].out[6]));
|
||||
ukey1[4] = swap32_S (h32_from_64_S (tmps[gid].out[5]));
|
||||
ukey1[5] = swap32_S (l32_from_64_S (tmps[gid].out[5]));
|
||||
ukey1[6] = swap32_S (h32_from_64_S (tmps[gid].out[4]));
|
||||
ukey1[7] = swap32_S (l32_from_64_S (tmps[gid].out[4]));
|
||||
|
||||
u32 ukey2[8];
|
||||
|
||||
ukey2[0] = swap32_S (h32_from_64_S (tmps[gid].out[3]));
|
||||
ukey2[1] = swap32_S (l32_from_64_S (tmps[gid].out[3]));
|
||||
ukey2[2] = swap32_S (h32_from_64_S (tmps[gid].out[2]));
|
||||
ukey2[3] = swap32_S (l32_from_64_S (tmps[gid].out[2]));
|
||||
ukey2[4] = swap32_S (h32_from_64_S (tmps[gid].out[1]));
|
||||
ukey2[5] = swap32_S (l32_from_64_S (tmps[gid].out[1]));
|
||||
ukey2[6] = swap32_S (h32_from_64_S (tmps[gid].out[0]));
|
||||
ukey2[7] = swap32_S (l32_from_64_S (tmps[gid].out[0]));
|
||||
|
||||
if (verify_header_aes (esalt_bufs, ukey1, ukey2, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_serpent (esalt_bufs, ukey1, ukey2) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_twofish (esalt_bufs, ukey1, ukey2) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
u32 ukey3[8];
|
||||
|
||||
ukey3[0] = swap32_S (h32_from_64_S (tmps[gid].out[15]));
|
||||
ukey3[1] = swap32_S (l32_from_64_S (tmps[gid].out[15]));
|
||||
ukey3[2] = swap32_S (h32_from_64_S (tmps[gid].out[14]));
|
||||
ukey3[3] = swap32_S (l32_from_64_S (tmps[gid].out[14]));
|
||||
ukey3[4] = swap32_S (h32_from_64_S (tmps[gid].out[13]));
|
||||
ukey3[5] = swap32_S (l32_from_64_S (tmps[gid].out[13]));
|
||||
ukey3[6] = swap32_S (h32_from_64_S (tmps[gid].out[12]));
|
||||
ukey3[7] = swap32_S (l32_from_64_S (tmps[gid].out[12]));
|
||||
|
||||
u32 ukey4[8];
|
||||
|
||||
ukey4[0] = swap32_S (h32_from_64_S (tmps[gid].out[11]));
|
||||
ukey4[1] = swap32_S (l32_from_64_S (tmps[gid].out[11]));
|
||||
ukey4[2] = swap32_S (h32_from_64_S (tmps[gid].out[10]));
|
||||
ukey4[3] = swap32_S (l32_from_64_S (tmps[gid].out[10]));
|
||||
ukey4[4] = swap32_S (h32_from_64_S (tmps[gid].out[ 9]));
|
||||
ukey4[5] = swap32_S (l32_from_64_S (tmps[gid].out[ 9]));
|
||||
ukey4[6] = swap32_S (h32_from_64_S (tmps[gid].out[ 8]));
|
||||
ukey4[7] = swap32_S (l32_from_64_S (tmps[gid].out[ 8]));
|
||||
|
||||
if (verify_header_aes_twofish (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_serpent_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
u32 ukey5[8];
|
||||
|
||||
ukey5[0] = swap32_S (h32_from_64_S (tmps[gid].out[23]));
|
||||
ukey5[1] = swap32_S (l32_from_64_S (tmps[gid].out[23]));
|
||||
ukey5[2] = swap32_S (h32_from_64_S (tmps[gid].out[22]));
|
||||
ukey5[3] = swap32_S (l32_from_64_S (tmps[gid].out[22]));
|
||||
ukey5[4] = swap32_S (h32_from_64_S (tmps[gid].out[21]));
|
||||
ukey5[5] = swap32_S (l32_from_64_S (tmps[gid].out[21]));
|
||||
ukey5[6] = swap32_S (h32_from_64_S (tmps[gid].out[20]));
|
||||
ukey5[7] = swap32_S (l32_from_64_S (tmps[gid].out[20]));
|
||||
|
||||
u32 ukey6[8];
|
||||
|
||||
ukey6[0] = swap32_S (h32_from_64_S (tmps[gid].out[19]));
|
||||
ukey6[1] = swap32_S (l32_from_64_S (tmps[gid].out[19]));
|
||||
ukey6[2] = swap32_S (h32_from_64_S (tmps[gid].out[18]));
|
||||
ukey6[3] = swap32_S (l32_from_64_S (tmps[gid].out[18]));
|
||||
ukey6[4] = swap32_S (h32_from_64_S (tmps[gid].out[17]));
|
||||
ukey6[5] = swap32_S (l32_from_64_S (tmps[gid].out[17]));
|
||||
ukey6[6] = swap32_S (h32_from_64_S (tmps[gid].out[16]));
|
||||
ukey6[7] = swap32_S (l32_from_64_S (tmps[gid].out[16]));
|
||||
|
||||
if (verify_header_aes_twofish_serpent (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (verify_header_serpent_twofish_aes (esalt_bufs, ukey1, ukey2, ukey3, ukey4, ukey5, ukey6, s_te0, s_te1, s_te2, s_te3, s_te4, s_td0, s_td1, s_td2, s_td3, s_td4) == 1)
|
||||
{
|
||||
if (atomic_inc (&hashes_shown[0]) == 0)
|
||||
{
|
||||
mark_hash (plains_buf, d_return_buf, salt_pos, digests_cnt, 0, 0, gid, 0);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,8 +14,14 @@
|
||||
|
||||
- Added pure kernels for hash-mode 11700 (Streebog-256)
|
||||
- Added pure kernels for hash-mode 11800 (Streebog-512)
|
||||
- Added hash-mode 18200 (Kerberos 5 AS-REP etype 23)
|
||||
- Added hash-mode 11750 (HMAC-Streebog-256 (key = $pass), big-endian)
|
||||
- Added hash-mode 11760 (HMAC-Streebog-256 (key = $salt), big-endian)
|
||||
- Added hash-mode 11850 (HMAC-Streebog-512 (key = $pass), big-endian)
|
||||
- Added hash-mode 11860 (HMAC-Streebog-512 (key = $salt), big-endian)
|
||||
- Added hash-mode 13771 (VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 512 bit)
|
||||
- Added hash-mode 13772 (VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1024 bit)
|
||||
- Added hash-mode 13773 (VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1536 bit)
|
||||
- Added hash-mode 18200 (Kerberos 5 AS-REP etype 23)
|
||||
|
||||
##
|
||||
## Improvements
|
||||
@ -24,8 +30,11 @@
|
||||
- Memory: Reduced default maximum bitmap size from 24 to 18 and give a notice to use --bitmap-max to restore
|
||||
- Memory: Limit maximum host memory to allocate depending on bitness
|
||||
- Tests: Added hash-mode 11700 (Streebog-256)
|
||||
- Tests: Added hash-mode 11750 (HMAC-Streebog-256 (key = $pass), big-endian)
|
||||
- Tests: Added hash-mode 11760 (HMAC-Streebog-256 (key = $salt), big-endian)
|
||||
- Tests: Added hash-mode 11800 (Streebog-512)
|
||||
- Tests: Added hash-mode 11850 (HMAC-Streebog-512 (key = $pass), big-endian)
|
||||
- Tests: Added hash-mode 11860 (HMAC-Streebog-512 (key = $salt), big-endian)
|
||||
|
||||
##
|
||||
## Bugs
|
||||
|
@ -176,7 +176,7 @@ _hashcat ()
|
||||
{
|
||||
local VERSION=5.0.0
|
||||
|
||||
local HASH_MODES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 124 130 131 132 133 140 141 150 160 200 300 400 500 501 600 900 1000 1100 1400 1410 1411 1420 1421 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2501 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5200 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9710 9720 9800 9810 9820 9900 10000 10100 10200 10300 10400 10410 10420 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11850 11900 12000 12001 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16801 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200"
|
||||
local HASH_MODES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 124 130 131 132 133 140 141 150 160 200 300 400 500 501 600 900 1000 1100 1400 1410 1411 1420 1421 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2501 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5200 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7800 7900 8000 8100 8200 8300 8400 8500 8600 8700 8800 8900 9000 9100 9200 9300 9400 9500 9600 9700 9710 9720 9800 9810 9820 9900 10000 10100 10200 10300 10400 10410 10420 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11850 11860 11900 12000 12001 12100 12200 12300 12400 12500 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16801 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200"
|
||||
local ATTACK_MODES="0 1 3 6 7"
|
||||
local HCCAPX_MESSAGE_PAIRS="0 1 2 3 4 5"
|
||||
local OUTFILE_FORMATS="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
|
||||
|
@ -720,6 +720,19 @@ typedef struct tc64_tmp
|
||||
|
||||
} tc64_tmp_t;
|
||||
|
||||
typedef struct vc64_sbog_tmp
|
||||
{
|
||||
u64 ipad_raw[8];
|
||||
u64 opad_raw[8];
|
||||
|
||||
u64 ipad_hash[8];
|
||||
u64 opad_hash[8];
|
||||
|
||||
u64 dgst[32];
|
||||
u64 out[32];
|
||||
|
||||
} vc64_sbog_tmp_t;
|
||||
|
||||
typedef struct agilekey_tmp
|
||||
{
|
||||
u32 ipad[5];
|
||||
@ -1216,6 +1229,9 @@ typedef enum kern_type
|
||||
KERN_TYPE_VCSHA256_XTS512 = 13751,
|
||||
KERN_TYPE_VCSHA256_XTS1024 = 13752,
|
||||
KERN_TYPE_VCSHA256_XTS1536 = 13753,
|
||||
KERN_TYPE_VCSBOG512_XTS512 = 13771,
|
||||
KERN_TYPE_VCSBOG512_XTS1024 = 13772,
|
||||
KERN_TYPE_VCSBOG512_XTS1536 = 13773,
|
||||
KERN_TYPE_MD5AIX = 6300,
|
||||
KERN_TYPE_SHA256AIX = 6400,
|
||||
KERN_TYPE_SHA512AIX = 6500,
|
||||
@ -1272,8 +1288,11 @@ typedef enum kern_type
|
||||
KERN_TYPE_CRC32 = 11500,
|
||||
KERN_TYPE_SEVEN_ZIP = 11600,
|
||||
KERN_TYPE_STREEBOG_256 = 11700,
|
||||
KERN_TYPE_HMAC_STREEBOG_256_PW = 11750,
|
||||
KERN_TYPE_HMAC_STREEBOG_256_SLT = 11760,
|
||||
KERN_TYPE_STREEBOG_512 = 11800,
|
||||
KERN_TYPE_HMAC_STREEBOG_512_PW = 11850,
|
||||
KERN_TYPE_HMAC_STREEBOG_512_SLT = 11860,
|
||||
KERN_TYPE_PBKDF2_MD5 = 11900,
|
||||
KERN_TYPE_PBKDF2_SHA1 = 12000,
|
||||
KERN_TYPE_ECRYPTFS = 12200,
|
||||
|
218
src/interface.c
218
src/interface.c
@ -221,8 +221,11 @@ static const char *ST_HASH_11400 = "$sip$*72087*1215344588738747***342210558720*
|
||||
static const char *ST_HASH_11500 = "c762de4a:00000000";
|
||||
static const char *ST_HASH_11600 = "$7z$0$14$0$$11$33363437353138333138300000000000$2365089182$16$12$d00321533b483f54a523f624a5f63269";
|
||||
static const char *ST_HASH_11700 = "57e9e50caec93d72e9498c211d6dc4f4d328248b48ecf46ba7abfa874f666e36";
|
||||
static const char *ST_HASH_11750 = "0f71c7c82700c9094ca95eee3d804cc283b538bec49428a9ef8da7b34effb3ba:08151337";
|
||||
static const char *ST_HASH_11760 = "d5c6b874338a492ac57ddc6871afc3c70dcfd264185a69d84cf839a07ef92b2c:08151337";
|
||||
static const char *ST_HASH_11800 = "5d5bdba48c8f89ee6c0a0e11023540424283e84902de08013aeeb626e819950bb32842903593a1d2e8f71897ff7fe72e17ac9ba8ce1d1d2f7e9c4359ea63bdc3";
|
||||
static const char *ST_HASH_11850 = "ddf70f583b785137a5aa272549278d5f8830b8344e16ce8058e1605bc49c83063eb3b5d65af9223bfbef097de1f4ff7bd80609c2277f8b033ad72dab89e9d1f9:11112222";
|
||||
static const char *ST_HASH_11850 = "be4555415af4a05078dcf260bb3c0a35948135df3dbf93f7c8b80574ceb0d71ea4312127f839b7707bf39ccc932d9e7cb799671183455889e8dde3738dfab5b6:08151337";
|
||||
static const char *ST_HASH_11860 = "bebf6831b3f9f958acb345a88cb98f30cb0374cff13e6012818487c8dc8d5857f23bca2caed280195ad558b8ce393503e632e901e8d1eb2ccb349a544ac195fd:08151337";
|
||||
static const char *ST_HASH_11900 = "md5:1000:NjAxMDY4MQ==:a00DtIW9hP9voC85fmEA5uVhgdDx67nSPSm9yADHjkI=";
|
||||
static const char *ST_HASH_12000 = "sha1:1000:MTYwNTM4MDU4Mzc4MzA=:aGghFQBtQ8+WVlMk5GEaMw==";
|
||||
static const char *ST_HASH_12001 = "{PKCS5S2}NTczNTY0NDY2NjQyNzU1Mx8gGiRGobaZYwumctGHbn2ZOHB8LkwzH+Z1gkWfy1zD";
|
||||
@ -254,6 +257,9 @@ static const char *ST_HASH_13733 = "5eb128daef63eff7e6db6aa10a8858f89964f47844ac
|
||||
static const char *ST_HASH_13751 = "b8a19a544414e540172595aef79e6616f504799b40a407edfb69d40534e93f0bdb3187876f0b7a21739b3a9bb02bd4752eac4d2021e65a2a9413cc389964fad46e2cd37f337eb3fe3c75909fe9911609d084fb8c09543f949e738fc2fcfa4825ca5f1e08678e711142553f95b19ba720fa6c8ae5d325be0b36b93c1b2683b0944d2ad4e858c1d83f21a302ef721b9a570233219b9fcf95919fef9ca353af32d7ceb0b3058986c4ed9580b8058325403d45048e43d9e94a1e8fbaa0658f82f81940ea821e1bd526829ee6478a32da4095ab9e7c04dac3b6cc08f99348467a5bf068ba54d0aededdf6005c18ee37e21ee8d980cabe470be49d332661761934f5c07126001c290002587ba4b49982fefaac41b62f7e74ce943bb40a2d78094f734d1bc2aa3dedff43ee2a7b8f3525743c76194637da9ebc2794bac14601e03aa98e9118023a184970b6b8f84f546af88b81e2fde836e286b57cbcbdd7d39334860571a5cc612b77f0c51c741854abeb320bf961aea99b88798199bf826970f2b1b8027499955f68e15328080289d8cf0569057e1ed887f956ce72b14dd13a1f61134e1195d13c68d9c298ae0183107e3a93dd13ee0730f1fabe3935ee70f4c6a1923abb3e0d0c8ecf45260c1444e7e73386acf29d3239d0160e097e6193099e10cc98f61bfda49df6b0635e73a9ccc7bdcc543306b40dd12b91023f61b21418af91";
|
||||
static const char *ST_HASH_13752 = "1c3197f32dc5b72b4d60474a7a43afefb0d2e856a8fc4957c3fb1188b62cb0ca002f585c125bb33c5a5e85a665afae9fce15cb127c2fd9b5ee074a48fd95b3a58364dfd645968187d546443ba234f5cc40e78c4bdcd1e0c6d0a1208dd892442bc1dfe2a45bc4821e843bb6d9f4adf742c48c432daf0d4a51d42cafdfca281f0fab0caabde8005405840383bbfd8dbf227384891ffa501531549e0b9562c2dd77f0e6552d253acb20cbee9a75d17ec283a46006ee89cd53e3b538e054952ae6db7aac9f2f190590e697a2a8e22d080e88c32f4d27b5afe100647da2a5c80cfcb69e5a3db67cb2fcd86d89c1c53fab1bf3a287bb9002d092e75eb1fe6269a1603545dbf97b9d7fcc9485b6400f7b0abaccc31642cefd83f037e7314c6990c51af24ae894cc1c49a09d18f3ad91b3ef37ae5414fef280ec776d9c0bf84b2eb312c8cb0046bedf6f29b4aab30cdb34333f613000a39bf650341cbf33bdd47ba7bd9be8108a1254390b045d82b208d21aa45de7ca399f8e91845b9ffb47d9e6eeb506965622a2e842ec6897277388cbb6ca2a50117e228e84bebd98f9aba40f38dc3bce3b576cb08596836e50ef276ee3a76b8ce76735fd172e9bae284aa83e2677dac56e4624e66604a90e2e3ae704c64a0f27b51ce9e472891bbc212b4a6055e4482b2e6963507f9ffb477224372289fcfee5764a5f4bc7307a509e7c37c69b4857";
|
||||
static const char *ST_HASH_13753 = "f421bdc1087b8319c12d84a680ceab0102e8e41c9ccffe76dbe0215dcfcb7b543f3e1bbedd099e88646823dae5bad8468b72436961ea8e0449a6b92b8bda7b9ba1fe215e997ec3be2ee5eb3b4d47c41d50998df2f883404fb66270f72b5ce666e7d5ca7847c4a8b2762723da1ad088b0ad75c4fd2ccbbfa4e3adf091b6af4f44f5484ce0c89a5b0db0cbe99b3a9d43d7ff6c4ddbc9636cacfedb26b59340c6eb3e8c587db41fc01f10da2974af96531b2bee5f0b9818c3b86a3cac4ba20e08c49be84af65eb40d51626161f4eef187bf5776a89e791f3f5cbcfaa510df201fb2bf35ff03e81d0572af9abbed3cac82681925a3d1954440a6037df78f7a1e63bea81c852571a21fb550f9fe114b82bf7b94290e362cef233186f17396488c0f259c83c50ac4f8cc27d3a134ddc98f14c2fe0dd6e7d6f5eec63848314dc5984979eeb79df326f80ee0e7f671072117903cb72bbbce4f750fca3f008dadf532241e05913704df6ca03edb9641775c3b6e3e328fd078c6d70298512118312cab8316bb6ddc0b860952c621b2bb4cec1b3c7da9b1cb4c494fec382fe85aefdc56570b54845a14651535d261db519be0e860a4e20c30c86cff6f9de6e16b68d09a0e9593d271df2740950e65f1fb16e3fee034183e540e2a3b0f76156f06946b5d1bfc62fe0cab3daa14603a8d21eb03a4d266e965b010c265c9a0e093084d262a8c03";
|
||||
static const char *ST_HASH_13771 = "444ec71554f0a2989b34bd8a5750ae7b5ed8b1ccdead29120fc030bd5186f312a7fa18ab4f4389d7798e43c073afd1e71dda2052db38dec04a700e8d6b488802ead0cf95d6e6cecc8eaf6464baf94a64acbbd1a86f826333115b6380bda18cf936150efd6ffc2a344bb78b0b4875781a8c5079772429ef50ddf148f35895496d2e39f32ffaf68a007b070b0beaad316c4b3adf43c0c58ad24430a34abf168ed455b64958ca5465cae0684adadc00f7b9c13fc7671b4520892d23aebff49ea92bc15e804cc650dc3bbd5b8f5122051636f0c576977d4b64ba355bf6e6a8e042fc5165f2a8affa51aa12ff718cee4c543976bf565997b4b57c74e79584e317f4bdb3920f2937c4251af87f432bb8ce78dcb30675246f0303db4aaea913c93be5a26d16dbf8d4d20773aa2a4608d2151491ca6593b51965baeaf9b58f78905df522bf88976fe9436a916c8de38d5a6ca7ca7f436e7982a36335a404298304322ebe194bb34e91e8f7ee7c6541679bb0ce9d80bf4431d1c475b1a785e943e57f8e27a4e665940389b6da2771bd27d943955185379f83ca6a124ec55b2b63d4ef2e2ad6ee27de25f959708f3a64facfe07f06e29459a14f02699751d530f258d0c744a759c188de4f9423f2bd21d3d999ea28df4f3a93a2c47a7e788fe43ccbfbe267277b048002da1ef8c1e7b26690230285675a3a8fdc0f2acf46a4cb24141b3ad1";
|
||||
static const char *ST_HASH_13772 = "0f5da0b17c60edcd392058752ec29c389b140b54cd1f94de43dccea703b1fd37936e75a500b7f9d4e94e7f214c4696c051be9697792a856ebf9c0f5a598cf8ba5621e49c7505eba3b4738acdc860b6ed648f52e5b673ae06bb04616de438a090ab19abea11c30984ead06859de9b7aec8e436c40816f67a56cb53d5f125e58c42225315a4bf494da8128f0df924bcf6ad4b91c9efc5cb0be67cb0cd753c392388d780f57aba39197513a191cc684e9ebee41bc901dd99e9a625141cf98e55e8f74d838baea3bf8f411b85c14eff8cddd1720c2539eef7a38a72c4ed9745a05476b6a16bcda2a5391c94b6f499e3bea64ff412d03d060741e938ed3dc905d8bd6dbb2420e9277251ebe3421be389ea8b02782baeb258b9ec7e0732b3817ee6da58209871aee4e16d57a132c6215782364570238157d8a7fdcd29f54ab2295f68d027dc9f2e0c951afad7500cafe3219e6530699918ac55f4fa1141bc3596155b05bae2fdc8b0a5438edeb5bb0cfac592565b20645be90b406a1fd59846957e7539fd8423bfd4c7ae7d608aacb084ae887baa1a83b14afff8d2063565086c66e293234a8667af39642b90a38c3a5bd4fa8a787c60f73882535c9b34cb7b243465dcc32aff29cee0e741ff059c6acd8ddcbdb3cfafecdcd0f45c84dd871be4fbffd5ac2ab9e01898009adcf7d932c37d6568ad875e4d6ea15db29a1e8ba5a4e86bd";
|
||||
static const char *ST_HASH_13773 = "18d2e8314961850f8fc26d2bc6f896db9c4eee301b5fa7295615166552b2422042c6cf6212187ec9c0234908e7934009c23ceed0c4858a7a4deecbc59b50a303afdc7d583cde1b0c06f0bf56162ef1d6d8df8f194aadcbe395780b3d1d7127faf39910eb10f4805abdd1c3ef7a66972603124a475e2b9224699e60a9e12f4096597f20c5fb0528f590d7bd317e41dc6a2128cf5e58a99803a28c213feb8286350b1d7ab56d43bb52e511f3c860e5002472a4454a549509c8ce0c34f17ece23d5b61aa7c63389c8ca44ed10c2caae03e7ed30b3ef98565926d7e4f3a2a9abf03b278083bed7aaadd78d5bffb7cd45ffae92990c06d9e9f375a77a94226035d1f90e177c46a04dab416dfb7ed7c4ed9ee7e84580bed65c5fee9f4b1545b9a7cf6af533870d393eced609aebe308ec1eee3729da09eb7df7a8d1282b15c4a1b8266a456c06b4ea20c209c549d5d6b58a861f8e15cca3b6cef114accbf470ec76d717f6d7d416d7a32f064ab560c1167f9ef4e93310fbd927b088bffbb0cf5d5c2e271c9cad4c604e489e9983a990b23e1a2f973682fdfe38df385474f73ecdc9bce701d01d627192d3051240f4b96bbdcf2346b275e05aa75add4acb97b286cc00e830fee95d0f86a8b1e315ccb6f3f8642180392b3baac01ed2c97c200489b5e5ca4dcb0a6417e622b6196482a10e640b2b6b08e3f62acac3d45dfc6b88c666205";
|
||||
static const char *ST_HASH_13800 = "060a4a94cb2263bcefe74705bd0efe7643d09c2bc25fc69f6a32c1b8d5a5d0d9:4647316184156410832507278642444030512402463246148636510356103432440257733102761444262383653100802140838605535187005586063548643765207865344068042278454875021452355870320020868064506248840047414683714173748364871633802572014845467035357710118327480707136422";
|
||||
static const char *ST_HASH_13900 = "058c1c3773340c8563421e2b17e60eb7c916787e:827500576";
|
||||
static const char *ST_HASH_14000 = "53b325182924b356:1412781058343178";
|
||||
@ -490,8 +496,11 @@ static const char *HT_11400 = "SIP digest authentication (MD5)";
|
||||
static const char *HT_11500 = "CRC32";
|
||||
static const char *HT_11600 = "7-Zip";
|
||||
static const char *HT_11700 = "GOST R 34.11-2012 (Streebog) 256-bit, big-endian";
|
||||
static const char *HT_11750 = "HMAC-Streebog-256 (key = $pass), big-endian";
|
||||
static const char *HT_11760 = "HMAC-Streebog-256 (key = $salt), big-endian";
|
||||
static const char *HT_11800 = "GOST R 34.11-2012 (Streebog) 512-bit, big-endian";
|
||||
static const char *HT_11850 = "HMAC-Streebog-512 (key = $pass), big-endian";
|
||||
static const char *HT_11860 = "HMAC-Streebog-512 (key = $salt), big-endian";
|
||||
static const char *HT_11900 = "PBKDF2-HMAC-MD5";
|
||||
static const char *HT_12000 = "PBKDF2-HMAC-SHA1";
|
||||
static const char *HT_12100 = "PBKDF2-HMAC-SHA512";
|
||||
@ -609,6 +618,9 @@ static const char *HT_13753 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1536 bit";
|
||||
static const char *HT_13761 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 512 bit + boot-mode";
|
||||
static const char *HT_13762 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1024 bit + boot-mode";
|
||||
static const char *HT_13763 = "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1536 bit + boot-mode";
|
||||
static const char *HT_13771 = "VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 512 bit";
|
||||
static const char *HT_13772 = "VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1024 bit";
|
||||
static const char *HT_13773 = "VeraCrypt PBKDF2-HMAC-Streebog-512 + XTS 1536 bit";
|
||||
static const char *HT_12001 = "Atlassian (PBKDF2-HMAC-SHA1)";
|
||||
|
||||
static const char *SIGNATURE_ANDROIDFDE = "$fde$";
|
||||
@ -13380,9 +13392,8 @@ int streebog_256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAY
|
||||
|
||||
token.token_cnt = 1;
|
||||
|
||||
token.len_min[0] = 64;
|
||||
token.len_max[0] = 64;
|
||||
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
token.len[0] = 64;
|
||||
token.attr[0] = TOKEN_ATTR_FIXED_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token);
|
||||
@ -13403,6 +13414,59 @@ int streebog_256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAY
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
int streebog_256s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig)
|
||||
{
|
||||
u32 *digest = (u32 *) hash_buf->digest;
|
||||
|
||||
salt_t *salt = hash_buf->salt;
|
||||
|
||||
token_t token;
|
||||
|
||||
token.token_cnt = 2;
|
||||
|
||||
token.sep[0] = ':';
|
||||
token.len_min[0] = 64;
|
||||
token.len_max[0] = 64;
|
||||
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.len_min[1] = SALT_MIN;
|
||||
token.len_max[1] = SALT_MAX;
|
||||
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH;
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_ST_HEX)
|
||||
{
|
||||
token.len_min[1] *= 2;
|
||||
token.len_max[1] *= 2;
|
||||
|
||||
token.attr[1] |= TOKEN_ATTR_VERIFY_HEX;
|
||||
}
|
||||
|
||||
const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token);
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
u8 *hash_pos = token.buf[0];
|
||||
|
||||
digest[0] = hex_to_u32 (hash_pos + 0);
|
||||
digest[1] = hex_to_u32 (hash_pos + 8);
|
||||
digest[2] = hex_to_u32 (hash_pos + 16);
|
||||
digest[3] = hex_to_u32 (hash_pos + 24);
|
||||
digest[4] = hex_to_u32 (hash_pos + 32);
|
||||
digest[5] = hex_to_u32 (hash_pos + 40);
|
||||
digest[6] = hex_to_u32 (hash_pos + 48);
|
||||
digest[7] = hex_to_u32 (hash_pos + 56);
|
||||
|
||||
u8 *salt_pos = token.buf[1];
|
||||
int salt_len = token.len[1];
|
||||
|
||||
const bool parse_rc = parse_and_store_generic_salt ((u8 *) salt->salt_buf, (int *) &salt->salt_len, salt_pos, salt_len, hashconfig);
|
||||
|
||||
if (parse_rc == false) return (PARSER_SALT_LENGTH);
|
||||
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
int streebog_512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSED hashconfig_t *hashconfig)
|
||||
{
|
||||
u32 *digest = (u32 *) hash_buf->digest;
|
||||
@ -13411,9 +13475,8 @@ int streebog_512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAY
|
||||
|
||||
token.token_cnt = 1;
|
||||
|
||||
token.len_min[0] = 128;
|
||||
token.len_max[0] = 128;
|
||||
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
token.len[0] = 128;
|
||||
token.attr[0] = TOKEN_ATTR_FIXED_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer (input_buf, input_len, &token);
|
||||
@ -13452,7 +13515,7 @@ int streebog_512s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA
|
||||
|
||||
token.token_cnt = 2;
|
||||
|
||||
token.sep[0] = hashconfig->separator;
|
||||
token.sep[0] = ':';
|
||||
token.len_min[0] = 128;
|
||||
token.len_max[0] = 128;
|
||||
token.attr[0] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
@ -18672,8 +18735,11 @@ const char *strhashtype (const u32 hash_mode)
|
||||
case 11500: return HT_11500;
|
||||
case 11600: return HT_11600;
|
||||
case 11700: return HT_11700;
|
||||
case 11750: return HT_11750;
|
||||
case 11760: return HT_11760;
|
||||
case 11800: return HT_11800;
|
||||
case 11850: return HT_11850;
|
||||
case 11860: return HT_11860;
|
||||
case 11900: return HT_11900;
|
||||
case 12000: return HT_12000;
|
||||
case 12001: return HT_12001;
|
||||
@ -18711,6 +18777,9 @@ const char *strhashtype (const u32 hash_mode)
|
||||
case 13761: return HT_13761;
|
||||
case 13762: return HT_13762;
|
||||
case 13763: return HT_13763;
|
||||
case 13771: return HT_13771;
|
||||
case 13772: return HT_13772;
|
||||
case 13773: return HT_13773;
|
||||
case 13800: return HT_13800;
|
||||
case 13900: return HT_13900;
|
||||
case 14000: return HT_14000;
|
||||
@ -21203,7 +21272,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
|
||||
|
||||
hcfree (data_buf);
|
||||
}
|
||||
else if (hash_mode == 11700)
|
||||
else if (hash_mode == 11700 || hash_mode == 11750 || hash_mode == 11760)
|
||||
{
|
||||
snprintf (out_buf, out_len - 1, "%08x%08x%08x%08x%08x%08x%08x%08x",
|
||||
digest_buf[0],
|
||||
@ -21215,7 +21284,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
|
||||
digest_buf[6],
|
||||
digest_buf[7]);
|
||||
}
|
||||
else if (hash_mode == 11800 || hash_mode == 11850)
|
||||
else if (hash_mode == 11800 || hash_mode == 11850 || hash_mode == 11860)
|
||||
{
|
||||
snprintf (out_buf, out_len - 1, "%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x",
|
||||
byte_swap_32 (digest_buf[ 0]),
|
||||
@ -26493,6 +26562,40 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 11750: hashconfig->hash_type = HASH_TYPE_STREEBOG_256;
|
||||
hashconfig->salt_type = SALT_TYPE_GENERIC;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_PT_ADD01;
|
||||
hashconfig->kern_type = KERN_TYPE_HMAC_STREEBOG_256_PW;
|
||||
hashconfig->dgst_size = DGST_SIZE_4_8;
|
||||
hashconfig->parse_func = streebog_256s_parse_hash;
|
||||
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE;
|
||||
hashconfig->dgst_pos0 = 0;
|
||||
hashconfig->dgst_pos1 = 1;
|
||||
hashconfig->dgst_pos2 = 2;
|
||||
hashconfig->dgst_pos3 = 3;
|
||||
hashconfig->st_hash = ST_HASH_11750;
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 11760: hashconfig->hash_type = HASH_TYPE_STREEBOG_256;
|
||||
hashconfig->salt_type = SALT_TYPE_GENERIC;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_PT_ADD01;
|
||||
hashconfig->kern_type = KERN_TYPE_HMAC_STREEBOG_256_SLT;
|
||||
hashconfig->dgst_size = DGST_SIZE_4_8;
|
||||
hashconfig->parse_func = streebog_256s_parse_hash;
|
||||
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE;
|
||||
hashconfig->dgst_pos0 = 0;
|
||||
hashconfig->dgst_pos1 = 1;
|
||||
hashconfig->dgst_pos2 = 2;
|
||||
hashconfig->dgst_pos3 = 3;
|
||||
hashconfig->st_hash = ST_HASH_11760;
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 11800: hashconfig->hash_type = HASH_TYPE_STREEBOG_512;
|
||||
hashconfig->salt_type = SALT_TYPE_NONE;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
@ -26527,6 +26630,23 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 11860: hashconfig->hash_type = HASH_TYPE_STREEBOG_512;
|
||||
hashconfig->salt_type = SALT_TYPE_GENERIC;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_PT_ADD01;
|
||||
hashconfig->kern_type = KERN_TYPE_HMAC_STREEBOG_512_SLT;
|
||||
hashconfig->dgst_size = DGST_SIZE_4_16;
|
||||
hashconfig->parse_func = streebog_512s_parse_hash;
|
||||
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE;
|
||||
hashconfig->dgst_pos0 = 0;
|
||||
hashconfig->dgst_pos1 = 1;
|
||||
hashconfig->dgst_pos2 = 2;
|
||||
hashconfig->dgst_pos3 = 3;
|
||||
hashconfig->st_hash = ST_HASH_11860;
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 11900: hashconfig->hash_type = HASH_TYPE_PBKDF2_MD5;
|
||||
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL;
|
||||
@ -27199,6 +27319,63 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 13771: hashconfig->hash_type = HASH_TYPE_STREEBOG_512;
|
||||
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL;
|
||||
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_BINARY_HASHFILE;
|
||||
hashconfig->kern_type = KERN_TYPE_VCSBOG512_XTS512;
|
||||
hashconfig->dgst_size = DGST_SIZE_8_8;
|
||||
hashconfig->parse_func = veracrypt_parse_hash_500000;
|
||||
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP
|
||||
| OPTI_TYPE_USES_BITS_64;
|
||||
hashconfig->dgst_pos0 = 0;
|
||||
hashconfig->dgst_pos1 = 1;
|
||||
hashconfig->dgst_pos2 = 2;
|
||||
hashconfig->dgst_pos3 = 3;
|
||||
hashconfig->st_hash = ST_HASH_13771;
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 13772: hashconfig->hash_type = HASH_TYPE_STREEBOG_512;
|
||||
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL;
|
||||
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_BINARY_HASHFILE;
|
||||
hashconfig->kern_type = KERN_TYPE_VCSBOG512_XTS1024;
|
||||
hashconfig->dgst_size = DGST_SIZE_8_8;
|
||||
hashconfig->parse_func = veracrypt_parse_hash_500000;
|
||||
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP
|
||||
| OPTI_TYPE_USES_BITS_64;
|
||||
hashconfig->dgst_pos0 = 0;
|
||||
hashconfig->dgst_pos1 = 1;
|
||||
hashconfig->dgst_pos2 = 2;
|
||||
hashconfig->dgst_pos3 = 3;
|
||||
hashconfig->st_hash = ST_HASH_13772;
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 13773: hashconfig->hash_type = HASH_TYPE_STREEBOG_512;
|
||||
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_OUTSIDE_KERNEL;
|
||||
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_BINARY_HASHFILE;
|
||||
hashconfig->kern_type = KERN_TYPE_VCSBOG512_XTS1536;
|
||||
hashconfig->dgst_size = DGST_SIZE_8_8;
|
||||
hashconfig->parse_func = veracrypt_parse_hash_500000;
|
||||
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP
|
||||
| OPTI_TYPE_USES_BITS_64;
|
||||
hashconfig->dgst_pos0 = 0;
|
||||
hashconfig->dgst_pos1 = 1;
|
||||
hashconfig->dgst_pos2 = 2;
|
||||
hashconfig->dgst_pos3 = 3;
|
||||
hashconfig->st_hash = ST_HASH_13773;
|
||||
hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN;
|
||||
break;
|
||||
|
||||
case 13800: hashconfig->hash_type = HASH_TYPE_SHA256;
|
||||
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
|
||||
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
@ -28127,6 +28304,9 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
case 13761: hashconfig->esalt_size = sizeof (tc_t); break;
|
||||
case 13762: hashconfig->esalt_size = sizeof (tc_t); break;
|
||||
case 13763: hashconfig->esalt_size = sizeof (tc_t); break;
|
||||
case 13771: hashconfig->esalt_size = sizeof (tc_t); break;
|
||||
case 13772: hashconfig->esalt_size = sizeof (tc_t); break;
|
||||
case 13773: hashconfig->esalt_size = sizeof (tc_t); break;
|
||||
case 13800: hashconfig->esalt_size = sizeof (win8phone_t); break;
|
||||
case 14600: hashconfig->esalt_size = sizeof (luks_t); break;
|
||||
case 14700: hashconfig->esalt_size = sizeof (itunes_backup_t); break;
|
||||
@ -28246,6 +28426,9 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
case 13761: hashconfig->tmp_size = sizeof (tc_tmp_t); break;
|
||||
case 13762: hashconfig->tmp_size = sizeof (tc_tmp_t); break;
|
||||
case 13763: hashconfig->tmp_size = sizeof (tc_tmp_t); break;
|
||||
case 13771: hashconfig->tmp_size = sizeof (vc64_sbog_tmp_t); break;
|
||||
case 13772: hashconfig->tmp_size = sizeof (vc64_sbog_tmp_t); break;
|
||||
case 13773: hashconfig->tmp_size = sizeof (vc64_sbog_tmp_t); break;
|
||||
case 14600: hashconfig->tmp_size = sizeof (luks_tmp_t); break;
|
||||
case 14700: hashconfig->tmp_size = sizeof (pbkdf2_sha1_tmp_t); break;
|
||||
case 14800: hashconfig->tmp_size = sizeof (pbkdf2_sha256_tmp_t); break;
|
||||
@ -28682,6 +28865,9 @@ int hashconfig_get_pw_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_kern
|
||||
case 13761: pw_max = 64; break; // VC limits itself to 64
|
||||
case 13762: pw_max = 64; break; // VC limits itself to 64
|
||||
case 13763: pw_max = 64; break; // VC limits itself to 64
|
||||
case 13771: pw_max = 64; break; // VC limits itself to 64
|
||||
case 13772: pw_max = 64; break; // VC limits itself to 64
|
||||
case 13773: pw_max = 64; break; // VC limits itself to 64
|
||||
case 14000: pw_max = 8; break; // Underlaying DES fixed
|
||||
case 14100: pw_max = 24; break; // Underlaying 3DES fixed
|
||||
case 14611: pw_max = PW_MAX; break;
|
||||
@ -28880,6 +29066,12 @@ int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
|
||||
break;
|
||||
case 13763: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
||||
break;
|
||||
case 13771: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||
break;
|
||||
case 13772: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||
break;
|
||||
case 13773: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||
break;
|
||||
}
|
||||
|
||||
salt->salt_iter -= 1;
|
||||
@ -29258,6 +29450,12 @@ void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, vo
|
||||
break;
|
||||
case 13763: salt->salt_iter = ROUNDS_VERACRYPT_200000;
|
||||
break;
|
||||
case 13771: salt->salt_iter = ROUNDS_VERACRYPT_500000;
|
||||
break;
|
||||
case 13772: salt->salt_iter = ROUNDS_VERACRYPT_500000;
|
||||
break;
|
||||
case 13773: salt->salt_iter = ROUNDS_VERACRYPT_500000;
|
||||
break;
|
||||
case 14600: salt->salt_iter = ROUNDS_LUKS;
|
||||
break;
|
||||
case 14700: salt->salt_iter = ROUNDS_ITUNES9_BACKUP - 1;
|
||||
|
@ -193,7 +193,10 @@ static const char *const USAGE_BIG[] =
|
||||
" 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
|
||||
" 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
|
||||
" 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
|
||||
" 11750 | HMAC-Streebog-256 (key = $pass), big-endian | Raw Hash, Authenticated",
|
||||
" 11760 | HMAC-Streebog-256 (key = $salt), big-endian | Raw Hash, Authenticated",
|
||||
" 11850 | HMAC-Streebog-512 (key = $pass), big-endian | Raw Hash, Authenticated",
|
||||
" 11860 | HMAC-Streebog-512 (key = $salt), big-endian | Raw Hash, Authenticated",
|
||||
" 14000 | DES (PT = $salt, key = $pass) | Raw Cipher, Known-Plaintext attack",
|
||||
" 14100 | 3DES (PT = $salt, key = $pass) | Raw Cipher, Known-Plaintext attack",
|
||||
" 14900 | Skip32 (PT = $salt, key = $pass) | Raw Cipher, Known-Plaintext attack",
|
||||
@ -351,6 +354,7 @@ static const char *const USAGE_BIG[] =
|
||||
" X | 4 = PBKDF2-HMAC-RIPEMD160 + boot-mode | Full-Disk Encryption (FDE)",
|
||||
" X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk Encryption (FDE)",
|
||||
" X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk Encryption (FDE)",
|
||||
" X | 7 = PBKDF2-HMAC-Streebog-512 | Full-Disk Encryption (FDE)",
|
||||
" Y | 1 = XTS 512 bit pure AES | Full-Disk Encryption (FDE)",
|
||||
" Y | 1 = XTS 512 bit pure Serpent | Full-Disk Encryption (FDE)",
|
||||
" Y | 1 = XTS 512 bit pure Twofish | Full-Disk Encryption (FDE)",
|
||||
|
@ -61,7 +61,7 @@ my $hashcat = "./hashcat";
|
||||
|
||||
my $MAX_LEN = 55;
|
||||
|
||||
my @modes = (0, 10, 11, 12, 20, 21, 22, 23, 30, 40, 50, 60, 100, 101, 110, 111, 112, 120, 121, 122, 125, 130, 131, 132, 133, 140, 141, 150, 160, 200, 300, 400, 500, 600, 900, 1000, 1100, 1300, 1400, 1410, 1411, 1420, 1430, 1440, 1441, 1450, 1460, 1500, 1600, 1700, 1710, 1711, 1720, 1730, 1740, 1722, 1731, 1750, 1760, 1800, 2100, 2400, 2410, 2500, 2600, 2611, 2612, 2711, 2811, 3000, 3100, 3200, 3710, 3711, 3300, 3500, 3610, 3720, 3800, 3910, 4010, 4110, 4210, 4300, 4400, 4500, 4520, 4521, 4522, 4600, 4700, 4800, 4900, 5100, 5300, 5400, 5500, 5600, 5700, 5800, 6000, 6100, 6300, 6400, 6500, 6600, 6700, 6800, 6900, 7000, 7100, 7200, 7300, 7400, 7500, 7700, 7701, 7800, 7801, 7900, 8000, 8100, 8200, 8300, 8400, 8500, 8600, 8700, 8900, 9100, 9200, 9300, 9400, 9500, 9600, 9700, 9800, 9900, 10000, 10100, 10200, 10300, 10400, 10500, 10600, 10700, 10800, 10900, 11000, 11100, 11200, 11300, 11400, 11500, 11600, 11700, 11800, 11850, 11900, 12000, 12001, 12100, 12200, 12300, 12400, 12600, 12700, 12800, 12900, 13000, 13100, 13200, 13300, 13400, 13500, 13600, 13800, 13900, 14000, 14100, 14400, 14700, 14800, 14900, 15000, 15100, 15200, 15300, 15400, 15500, 15600, 15700, 15900, 16000, 16100, 16200, 16300, 16400, 16500, 16600, 16700, 16800, 16900, 17300, 17400, 17500, 17600, 17700, 17800, 17900, 18000, 18100, 18200, 99999);
|
||||
my @modes = (0, 10, 11, 12, 20, 21, 22, 23, 30, 40, 50, 60, 100, 101, 110, 111, 112, 120, 121, 122, 125, 130, 131, 132, 133, 140, 141, 150, 160, 200, 300, 400, 500, 600, 900, 1000, 1100, 1300, 1400, 1410, 1411, 1420, 1430, 1440, 1441, 1450, 1460, 1500, 1600, 1700, 1710, 1711, 1720, 1730, 1740, 1722, 1731, 1750, 1760, 1800, 2100, 2400, 2410, 2500, 2600, 2611, 2612, 2711, 2811, 3000, 3100, 3200, 3710, 3711, 3300, 3500, 3610, 3720, 3800, 3910, 4010, 4110, 4210, 4300, 4400, 4500, 4520, 4521, 4522, 4600, 4700, 4800, 4900, 5100, 5300, 5400, 5500, 5600, 5700, 5800, 6000, 6100, 6300, 6400, 6500, 6600, 6700, 6800, 6900, 7000, 7100, 7200, 7300, 7400, 7500, 7700, 7701, 7800, 7801, 7900, 8000, 8100, 8200, 8300, 8400, 8500, 8600, 8700, 8900, 9100, 9200, 9300, 9400, 9500, 9600, 9700, 9800, 9900, 10000, 10100, 10200, 10300, 10400, 10500, 10600, 10700, 10800, 10900, 11000, 11100, 11200, 11300, 11400, 11500, 11600, 11700, 11750, 11760, 11800, 11850, 11860, 11900, 12000, 12001, 12100, 12200, 12300, 12400, 12600, 12700, 12800, 12900, 13000, 13100, 13200, 13300, 13400, 13500, 13600, 13800, 13900, 14000, 14100, 14400, 14700, 14800, 14900, 15000, 15100, 15200, 15300, 15400, 15500, 15600, 15700, 15900, 16000, 16100, 16200, 16300, 16400, 16500, 16600, 16700, 16800, 16900, 17300, 17400, 17500, 17600, 17700, 17800, 17900, 18000, 18100, 18200, 99999);
|
||||
|
||||
my %is_utf16le = map { $_ => 1 } qw (30 40 130 131 132 133 140 141 1000 1100 1430 1440 1441 1730 1740 1731 5500 5600 8000 9400 9500 9600 9700 9800 11600 13500 13800);
|
||||
my %less_fifteen = map { $_ => 1 } qw (500 1600 1800 3200 6300 7400 10500 10700);
|
||||
@ -242,7 +242,7 @@ sub verify
|
||||
$word = substr ($line, $index + 1);
|
||||
}
|
||||
# hash:salt
|
||||
elsif ($mode == 10 || $mode == 11 || $mode == 12 || $mode == 20 || $mode == 21 || $mode == 22 || $mode == 23 || $mode == 30 || $mode == 40 || $mode == 50 || $mode == 60 || $mode == 110 || $mode == 112 || $mode == 120 || $mode == 121 || $mode == 130 || $mode == 140 || $mode == 150 || $mode == 160 || $mode == 1100 || $mode == 1410 || $mode == 1420 || $mode == 1430 || $mode == 1440 || $mode == 1450 || $mode == 1460 || $mode == 1710 || $mode == 1720 || $mode == 1730 || $mode == 1740 || $mode == 1750 || $mode == 1760 || $mode == 2410 || $mode == 2611 || $mode == 2711 || $mode == 2811 || $mode == 3100 || $mode == 3610 || $mode == 3710 || $mode == 3720 || $mode == 3800 || $mode == 3910 || $mode == 4010 || $mode == 4110 || $mode == 4210 || $mode == 4520 || $mode == 4521 || $mode == 4522 || $mode == 4900 || $mode == 5800 || $mode == 8400 || $mode == 11000 || $mode == 11850 || $mode == 12600 || $mode == 13500 || $mode == 13800 || $mode == 13900 || $mode == 14000 || $mode == 14100 || $mode == 14400 || $mode == 14900 || $mode == 15000 || $mode == 18100)
|
||||
elsif ($mode == 10 || $mode == 11 || $mode == 12 || $mode == 20 || $mode == 21 || $mode == 22 || $mode == 23 || $mode == 30 || $mode == 40 || $mode == 50 || $mode == 60 || $mode == 110 || $mode == 112 || $mode == 120 || $mode == 121 || $mode == 130 || $mode == 140 || $mode == 150 || $mode == 160 || $mode == 1100 || $mode == 1410 || $mode == 1420 || $mode == 1430 || $mode == 1440 || $mode == 1450 || $mode == 1460 || $mode == 1710 || $mode == 1720 || $mode == 1730 || $mode == 1740 || $mode == 1750 || $mode == 1760 || $mode == 2410 || $mode == 2611 || $mode == 2711 || $mode == 2811 || $mode == 3100 || $mode == 3610 || $mode == 3710 || $mode == 3720 || $mode == 3800 || $mode == 3910 || $mode == 4010 || $mode == 4110 || $mode == 4210 || $mode == 4520 || $mode == 4521 || $mode == 4522 || $mode == 4900 || $mode == 5800 || $mode == 8400 || $mode == 11000 || $mode == 11750 || $mode == 11760 || $mode == 11850 || $mode == 11860 || $mode == 12600 || $mode == 13500 || $mode == 13800 || $mode == 13900 || $mode == 14000 || $mode == 14100 || $mode == 14400 || $mode == 14900 || $mode == 15000 || $mode == 18100)
|
||||
{
|
||||
# get hash
|
||||
my $index1 = index ($line, ":");
|
||||
@ -3592,7 +3592,7 @@ sub passthrough
|
||||
{
|
||||
$tmp_hash = gen_hash ($mode, $word_buf, "");
|
||||
}
|
||||
elsif ($mode == 10 || $mode == 20 || $mode == 23 || $mode == 30 || $mode == 40 || $mode == 50 || $mode == 60 || $mode == 110 || $mode == 120 || $mode == 130 || $mode == 140 || $mode == 150 || $mode == 160 || $mode == 1410 || $mode == 1411 || $mode == 1420 || $mode == 1430 || $mode == 1440 || $mode == 1450 || $mode == 1460 || $mode == 1710 || $mode == 1711 || $mode == 1720 || $mode == 1730 || $mode == 1740 || $mode == 1750 || $mode == 1760 || $mode == 3610 || $mode == 3710 || $mode == 3711 || $mode == 3720 || $mode == 3800 || $mode == 3910 || $mode == 4010 || $mode == 4110 || $mode == 4210 || $mode == 4900 || $mode == 8900 || $mode == 10000 || $mode == 10200 || $mode == 10900 || $mode == 11850 || $mode == 11900 || $mode == 12000 || $mode == 12100 || $mode == 18100)
|
||||
elsif ($mode == 10 || $mode == 20 || $mode == 23 || $mode == 30 || $mode == 40 || $mode == 50 || $mode == 60 || $mode == 110 || $mode == 120 || $mode == 130 || $mode == 140 || $mode == 150 || $mode == 160 || $mode == 1410 || $mode == 1411 || $mode == 1420 || $mode == 1430 || $mode == 1440 || $mode == 1450 || $mode == 1460 || $mode == 1710 || $mode == 1711 || $mode == 1720 || $mode == 1730 || $mode == 1740 || $mode == 1750 || $mode == 1760 || $mode == 3610 || $mode == 3710 || $mode == 3711 || $mode == 3720 || $mode == 3800 || $mode == 3910 || $mode == 4010 || $mode == 4110 || $mode == 4210 || $mode == 4900 || $mode == 8900 || $mode == 10000 || $mode == 10200 || $mode == 10900 || $mode == 11750 || $mode == 11760 || $mode == 11850 || $mode == 11860 || $mode == 11900 || $mode == 12000 || $mode == 12100 || $mode == 18100)
|
||||
{
|
||||
my $salt_len = get_random_num (1, 15);
|
||||
|
||||
@ -4138,7 +4138,7 @@ sub single
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($mode == 10 || $mode == 20 || $mode == 23 || $mode == 30 || $mode == 40 || $mode == 50 || $mode == 60 || $mode == 110 || $mode == 120 || $mode == 121 || $mode == 130 || $mode == 140 || $mode == 150 || $mode == 160 || $mode == 1410 || $mode == 1411 || $mode == 1420 || $mode == 1430 || $mode == 1440 || $mode == 1450 || $mode == 1460 || $mode == 1710 || $mode == 1711 || $mode == 1720 || $mode == 1730 || $mode == 1740 || $mode == 1750 || $mode == 1760 || $mode == 3610 || $mode == 3710 || $mode == 3711 || $mode == 3720 || $mode == 3910 || $mode == 4010 || $mode == 4110 || $mode == 4210 || $mode == 8900 || $mode == 10000 || $mode == 10200 || $mode == 10900 || $mode == 11850 || $mode == 11900 || $mode == 12000 || $mode == 12100 || $mode == 16500 || $mode == 18100)
|
||||
elsif ($mode == 10 || $mode == 20 || $mode == 23 || $mode == 30 || $mode == 40 || $mode == 50 || $mode == 60 || $mode == 110 || $mode == 120 || $mode == 121 || $mode == 130 || $mode == 140 || $mode == 150 || $mode == 160 || $mode == 1410 || $mode == 1411 || $mode == 1420 || $mode == 1430 || $mode == 1440 || $mode == 1450 || $mode == 1460 || $mode == 1710 || $mode == 1711 || $mode == 1720 || $mode == 1730 || $mode == 1740 || $mode == 1750 || $mode == 1760 || $mode == 3610 || $mode == 3710 || $mode == 3711 || $mode == 3720 || $mode == 3910 || $mode == 4010 || $mode == 4110 || $mode == 4210 || $mode == 8900 || $mode == 10000 || $mode == 10200 || $mode == 10900 || $mode == 11750 || $mode == 11760 || $mode == 11850 || $mode == 11860 || $mode == 11900 || $mode == 12000 || $mode == 12100 || $mode == 16500 || $mode == 18100)
|
||||
{
|
||||
my $salt_len = get_random_num (1, 15);
|
||||
|
||||
@ -7922,6 +7922,42 @@ END_CODE
|
||||
|
||||
$tmp_hash = `python2 -c '$python_code'`;
|
||||
}
|
||||
elsif ($mode == 11750)
|
||||
{
|
||||
my $python_code = <<"END_CODE";
|
||||
|
||||
import binascii
|
||||
import hmac
|
||||
import sys
|
||||
from pygost import gost34112012256
|
||||
key = b"$word_buf"
|
||||
msg = b"$salt_buf"
|
||||
digest = hmac.new(key, msg, gost34112012256).digest()
|
||||
sys.stdout.write(binascii.hexlify(digest[::-1]))
|
||||
|
||||
END_CODE
|
||||
|
||||
$hash_buf = `python2 -c '$python_code'`;
|
||||
$tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf);
|
||||
}
|
||||
elsif ($mode == 11760)
|
||||
{
|
||||
my $python_code = <<"END_CODE";
|
||||
|
||||
import binascii
|
||||
import hmac
|
||||
import sys
|
||||
from pygost import gost34112012256
|
||||
key = b"$salt_buf"
|
||||
msg = b"$word_buf"
|
||||
digest = hmac.new(key, msg, gost34112012256).digest()
|
||||
sys.stdout.write(binascii.hexlify(digest[::-1]))
|
||||
|
||||
END_CODE
|
||||
|
||||
$hash_buf = `python2 -c '$python_code'`;
|
||||
$tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf);
|
||||
}
|
||||
elsif ($mode == 11800)
|
||||
{
|
||||
my $python_code = <<"END_CODE";
|
||||
@ -7938,9 +7974,6 @@ END_CODE
|
||||
}
|
||||
elsif ($mode == 11850)
|
||||
{
|
||||
#todo: python hmac; look at salt value?
|
||||
#$hash_buf = hmac_hex ($salt_buf, $word_buf, \&sha512, 128);
|
||||
#$tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf);
|
||||
my $python_code = <<"END_CODE";
|
||||
|
||||
import binascii
|
||||
@ -7952,6 +7985,24 @@ msg = b"$salt_buf"
|
||||
digest = hmac.new(key, msg, gost34112012512).digest()
|
||||
sys.stdout.write(binascii.hexlify(digest[::-1]))
|
||||
|
||||
END_CODE
|
||||
|
||||
$hash_buf = `python2 -c '$python_code'`;
|
||||
$tmp_hash = sprintf ("%s:%s", $hash_buf, $salt_buf);
|
||||
}
|
||||
elsif ($mode == 11860)
|
||||
{
|
||||
my $python_code = <<"END_CODE";
|
||||
|
||||
import binascii
|
||||
import hmac
|
||||
import sys
|
||||
from pygost import gost34112012512
|
||||
key = b"$salt_buf"
|
||||
msg = b"$word_buf"
|
||||
digest = hmac.new(key, msg, gost34112012512).digest()
|
||||
sys.stdout.write(binascii.hexlify(digest[::-1]))
|
||||
|
||||
END_CODE
|
||||
|
||||
$hash_buf = `python2 -c '$python_code'`;
|
||||
|
@ -9,7 +9,7 @@ TDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# missing hash types: 5200,6251,6261,6271,6281
|
||||
|
||||
HASH_TYPES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 125 130 131 132 133 140 141 150 160 200 300 400 500 600 900 1000 1100 1300 1400 1410 1411 1420 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7701 7800 7801 7900 8000 8100 8200 8300 8400 8500 8600 8700 8900 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 10100 10200 10300 10400 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11800 11850 11900 12000 12001 12100 12200 12300 12400 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14400 14600 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200 99999"
|
||||
HASH_TYPES="0 10 11 12 20 21 22 23 30 40 50 60 100 101 110 111 112 120 121 122 125 130 131 132 133 140 141 150 160 200 300 400 500 600 900 1000 1100 1300 1400 1410 1411 1420 1430 1440 1441 1450 1460 1500 1600 1700 1710 1711 1720 1722 1730 1731 1740 1750 1760 1800 2100 2400 2410 2500 2600 2611 2612 2711 2811 3000 3100 3200 3710 3711 3800 3910 4010 4110 4300 4400 4500 4520 4521 4522 4700 4800 4900 5100 5300 5400 5500 5600 5700 5800 6000 6100 6211 6212 6213 6221 6222 6223 6231 6232 6233 6241 6242 6243 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7700 7701 7800 7801 7900 8000 8100 8200 8300 8400 8500 8600 8700 8900 9100 9200 9300 9400 9500 9600 9700 9800 9900 10000 10100 10200 10300 10400 10500 10600 10700 10800 10900 11000 11100 11200 11300 11400 11500 11600 11700 11750 11760 11800 11850 11860 11900 12000 12001 12100 12200 12300 12400 12600 12700 12800 12900 13000 13100 13200 13300 13400 13500 13600 13800 13900 14000 14100 14400 14600 14700 14800 14900 15000 15100 15200 15300 15400 15500 15600 15700 15900 16000 16100 16200 16300 16400 16500 16600 16700 16800 16900 17300 17400 17500 17600 17700 17800 17900 18000 18100 18200 99999"
|
||||
|
||||
#ATTACK_MODES="0 1 3 6 7"
|
||||
ATTACK_MODES="0 1 3 7"
|
||||
|
Loading…
Reference in New Issue
Block a user