PoC using a length-independant MD4 hash processing in -m 2100

pull/1284/head
jsteube 7 years ago
parent a673aee037
commit 4174f06008

@ -0,0 +1,639 @@
// important notes on this:
// input buf unused bytes needs to be set to zero
// input buf need to be in algorithm native byte order (md5 = LE, sha1 = BE, etc)
// input buf need to be 64 byte aligned when usin md5_update()
typedef struct md4_ctx_scalar
{
u32 h[4];
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
int len;
} md4_ctx_scalar_t;
void md4_transform_scalar (const u32 w0[4], const u32 w1[4], const u32 w2[4], const u32 w3[4], u32 digest[4])
{
u32 a = digest[0];
u32 b = digest[1];
u32 c = digest[2];
u32 d = digest[3];
MD4_STEP_S (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
MD4_STEP_S (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
MD4_STEP_S (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
MD4_STEP_S (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
MD4_STEP_S (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
MD4_STEP_S (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
MD4_STEP_S (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
MD4_STEP_S (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
MD4_STEP_S (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
MD4_STEP_S (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
MD4_STEP_S (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
MD4_STEP_S (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
MD4_STEP_S (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
MD4_STEP_S (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
MD4_STEP_S (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
MD4_STEP_S (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
MD4_STEP_S (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
MD4_STEP_S (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
MD4_STEP_S (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
MD4_STEP_S (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
MD4_STEP_S (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
MD4_STEP_S (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
MD4_STEP_S (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
MD4_STEP_S (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
MD4_STEP_S (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
MD4_STEP_S (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
MD4_STEP_S (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
MD4_STEP_S (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
MD4_STEP_S (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
MD4_STEP_S (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
MD4_STEP_S (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
MD4_STEP_S (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
MD4_STEP_S (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
MD4_STEP_S (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
MD4_STEP_S (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
MD4_STEP_S (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
MD4_STEP_S (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
MD4_STEP_S (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
MD4_STEP_S (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
MD4_STEP_S (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
MD4_STEP_S (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
MD4_STEP_S (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
MD4_STEP_S (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
MD4_STEP_S (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
MD4_STEP_S (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
MD4_STEP_S (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
MD4_STEP_S (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
MD4_STEP_S (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
digest[0] += a;
digest[1] += b;
digest[2] += c;
digest[3] += d;
}
void md4_init_scalar (md4_ctx_scalar_t *md4_ctx)
{
md4_ctx->h[0] = MD4M_A;
md4_ctx->h[1] = MD4M_B;
md4_ctx->h[2] = MD4M_C;
md4_ctx->h[3] = MD4M_D;
md4_ctx->w0[0] = 0;
md4_ctx->w0[1] = 0;
md4_ctx->w0[2] = 0;
md4_ctx->w0[3] = 0;
md4_ctx->w1[0] = 0;
md4_ctx->w1[1] = 0;
md4_ctx->w1[2] = 0;
md4_ctx->w1[3] = 0;
md4_ctx->w2[0] = 0;
md4_ctx->w2[1] = 0;
md4_ctx->w2[2] = 0;
md4_ctx->w2[3] = 0;
md4_ctx->w3[0] = 0;
md4_ctx->w3[1] = 0;
md4_ctx->w3[2] = 0;
md4_ctx->w3[3] = 0;
md4_ctx->len = 0;
}
void md4_update_scalar_64 (md4_ctx_scalar_t *md4_ctx, u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const int len)
{
const int pos = md4_ctx->len & 0x3f;
md4_ctx->len += len;
if ((pos + len) < 64)
{
switch_buffer_by_offset_le_S (w0, w1, w2, w3, pos);
md4_ctx->w0[0] |= w0[0];
md4_ctx->w0[1] |= w0[1];
md4_ctx->w0[2] |= w0[2];
md4_ctx->w0[3] |= w0[3];
md4_ctx->w1[0] |= w1[0];
md4_ctx->w1[1] |= w1[1];
md4_ctx->w1[2] |= w1[2];
md4_ctx->w1[3] |= w1[3];
md4_ctx->w2[0] |= w2[0];
md4_ctx->w2[1] |= w2[1];
md4_ctx->w2[2] |= w2[2];
md4_ctx->w2[3] |= w2[3];
md4_ctx->w3[0] |= w3[0];
md4_ctx->w3[1] |= w3[1];
md4_ctx->w3[2] |= w3[2];
md4_ctx->w3[3] |= w3[3];
}
else
{
u32 c0[4] = { 0 };
u32 c1[4] = { 0 };
u32 c2[4] = { 0 };
u32 c3[4] = { 0 };
switch_buffer_by_offset_carry_le_S (w0, w1, w2, w3, c0, c1, c2, c3, pos);
md4_ctx->w0[0] |= w0[0];
md4_ctx->w0[1] |= w0[1];
md4_ctx->w0[2] |= w0[2];
md4_ctx->w0[3] |= w0[3];
md4_ctx->w1[0] |= w1[0];
md4_ctx->w1[1] |= w1[1];
md4_ctx->w1[2] |= w1[2];
md4_ctx->w1[3] |= w1[3];
md4_ctx->w2[0] |= w2[0];
md4_ctx->w2[1] |= w2[1];
md4_ctx->w2[2] |= w2[2];
md4_ctx->w2[3] |= w2[3];
md4_ctx->w3[0] |= w3[0];
md4_ctx->w3[1] |= w3[1];
md4_ctx->w3[2] |= w3[2];
md4_ctx->w3[3] |= w3[3];
md4_transform_scalar (md4_ctx->w0, md4_ctx->w1, md4_ctx->w2, md4_ctx->w3, md4_ctx->h);
md4_ctx->w0[0] = c0[0];
md4_ctx->w0[1] = c0[1];
md4_ctx->w0[2] = c0[2];
md4_ctx->w0[3] = c0[3];
md4_ctx->w1[0] = c1[0];
md4_ctx->w1[1] = c1[1];
md4_ctx->w1[2] = c1[2];
md4_ctx->w1[3] = c1[3];
md4_ctx->w2[0] = c2[0];
md4_ctx->w2[1] = c2[1];
md4_ctx->w2[2] = c2[2];
md4_ctx->w2[3] = c2[3];
md4_ctx->w3[0] = c3[0];
md4_ctx->w3[1] = c3[1];
md4_ctx->w3[2] = c3[2];
md4_ctx->w3[3] = c3[3];
}
}
void md4_update_scalar (md4_ctx_scalar_t *md4_ctx, const u32 *w, const int len)
{
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
int i;
int j;
for (i = 0, j = 0; i < len - 64; i += 64, j += 16)
{
w0[0] = w[i + 0];
w0[1] = w[i + 1];
w0[2] = w[i + 2];
w0[3] = w[i + 3];
w1[0] = w[i + 4];
w1[1] = w[i + 5];
w1[2] = w[i + 6];
w1[3] = w[i + 7];
w2[0] = w[i + 8];
w2[1] = w[i + 9];
w2[2] = w[i + 10];
w2[3] = w[i + 11];
w3[0] = w[i + 12];
w3[1] = w[i + 13];
w3[2] = w[i + 14];
w3[3] = w[i + 15];
md4_update_scalar_64 (md4_ctx, w0, w1, w2, w3, 64);
}
w0[0] = w[i + 0];
w0[1] = w[i + 1];
w0[2] = w[i + 2];
w0[3] = w[i + 3];
w1[0] = w[i + 4];
w1[1] = w[i + 5];
w1[2] = w[i + 6];
w1[3] = w[i + 7];
w2[0] = w[i + 8];
w2[1] = w[i + 9];
w2[2] = w[i + 10];
w2[3] = w[i + 11];
w3[0] = w[i + 12];
w3[1] = w[i + 13];
w3[2] = w[i + 14];
w3[3] = w[i + 15];
md4_update_scalar_64 (md4_ctx, w0, w1, w2, w3, len & 0x3f);
}
void md4_update_scalar_global (md4_ctx_scalar_t *md4_ctx, const __global u32 *w, const int len)
{
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
int i;
int j;
for (i = 0, j = 0; i < len - 64; i += 64, j += 16)
{
w0[0] = w[i + 0];
w0[1] = w[i + 1];
w0[2] = w[i + 2];
w0[3] = w[i + 3];
w1[0] = w[i + 4];
w1[1] = w[i + 5];
w1[2] = w[i + 6];
w1[3] = w[i + 7];
w2[0] = w[i + 8];
w2[1] = w[i + 9];
w2[2] = w[i + 10];
w2[3] = w[i + 11];
w3[0] = w[i + 12];
w3[1] = w[i + 13];
w3[2] = w[i + 14];
w3[3] = w[i + 15];
md4_update_scalar_64 (md4_ctx, w0, w1, w2, w3, 64);
}
w0[0] = w[i + 0];
w0[1] = w[i + 1];
w0[2] = w[i + 2];
w0[3] = w[i + 3];
w1[0] = w[i + 4];
w1[1] = w[i + 5];
w1[2] = w[i + 6];
w1[3] = w[i + 7];
w2[0] = w[i + 8];
w2[1] = w[i + 9];
w2[2] = w[i + 10];
w2[3] = w[i + 11];
w3[0] = w[i + 12];
w3[1] = w[i + 13];
w3[2] = w[i + 14];
w3[3] = w[i + 15];
md4_update_scalar_64 (md4_ctx, w0, w1, w2, w3, len & 0x3f);
}
void md4_update_scalar_global_utf16le (md4_ctx_scalar_t *md4_ctx, const __global u32 *w, const int len)
{
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
int i;
int j;
for (i = 0, j = 0; i < len - 32; i += 32, j += 8)
{
w0[0] = w[i + 0];
w0[1] = w[i + 1];
w0[2] = w[i + 2];
w0[3] = w[i + 3];
w1[0] = w[i + 4];
w1[1] = w[i + 5];
w1[2] = w[i + 6];
w1[3] = w[i + 7];
make_utf16le_S (w1, w2, w3);
make_utf16le_S (w0, w0, w1);
md4_update_scalar_64 (md4_ctx, w0, w1, w2, w3, 64);
}
w0[0] = w[i + 0];
w0[1] = w[i + 1];
w0[2] = w[i + 2];
w0[3] = w[i + 3];
w1[0] = w[i + 4];
w1[1] = w[i + 5];
w1[2] = w[i + 6];
w1[3] = w[i + 7];
make_utf16le_S (w1, w2, w3);
make_utf16le_S (w0, w0, w1);
md4_update_scalar_64 (md4_ctx, w0, w1, w2, w3, (len * 2) & 0x3f);
}
void md4_final_scalar (md4_ctx_scalar_t *md4_ctx)
{
const int pos = md4_ctx->len & 0x3f;
append_0x80_4x4_S (md4_ctx->w0, md4_ctx->w1, md4_ctx->w2, md4_ctx->w3, pos);
if (pos >= 56)
{
md4_transform_scalar (md4_ctx->w0, md4_ctx->w1, md4_ctx->w2, md4_ctx->w3, md4_ctx->h);
md4_ctx->w0[0] = 0;
md4_ctx->w0[1] = 0;
md4_ctx->w0[2] = 0;
md4_ctx->w0[3] = 0;
md4_ctx->w1[0] = 0;
md4_ctx->w1[1] = 0;
md4_ctx->w1[2] = 0;
md4_ctx->w1[3] = 0;
md4_ctx->w2[0] = 0;
md4_ctx->w2[1] = 0;
md4_ctx->w2[2] = 0;
md4_ctx->w2[3] = 0;
md4_ctx->w3[0] = 0;
md4_ctx->w3[1] = 0;
md4_ctx->w3[2] = 0;
md4_ctx->w3[3] = 0;
}
md4_ctx->w3[2] = md4_ctx->len * 8;
md4_transform_scalar (md4_ctx->w0, md4_ctx->w1, md4_ctx->w2, md4_ctx->w3, md4_ctx->h);
}
void md4_optimize_max_length_scalar (md4_ctx_scalar_t *md4_ctx, const int bits)
{
md4_ctx->len &= (1 << bits) - 1;
}
// while input buf can be a vector datatype, the length of the different elements can not
typedef struct md4_ctx_vector
{
u32x h[4];
u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
int len;
} md4_ctx_vector_t;
void md4_transform_vector (const u32x w0[4], const u32x w1[4], const u32x w2[4], const u32x w3[4], u32x digest[4])
{
u32x a = digest[0];
u32x b = digest[1];
u32x c = digest[2];
u32x d = digest[3];
MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
digest[0] += a;
digest[1] += b;
digest[2] += c;
digest[3] += d;
}
void md4_init_vector (md4_ctx_vector_t *md4_ctx)
{
md4_ctx->h[0] = MD4M_A;
md4_ctx->h[1] = MD4M_B;
md4_ctx->h[2] = MD4M_C;
md4_ctx->h[3] = MD4M_D;
md4_ctx->w0[0] = 0;
md4_ctx->w0[1] = 0;
md4_ctx->w0[2] = 0;
md4_ctx->w0[3] = 0;
md4_ctx->w1[0] = 0;
md4_ctx->w1[1] = 0;
md4_ctx->w1[2] = 0;
md4_ctx->w1[3] = 0;
md4_ctx->w2[0] = 0;
md4_ctx->w2[1] = 0;
md4_ctx->w2[2] = 0;
md4_ctx->w2[3] = 0;
md4_ctx->w3[0] = 0;
md4_ctx->w3[1] = 0;
md4_ctx->w3[2] = 0;
md4_ctx->w3[3] = 0;
md4_ctx->len = 0;
}
void md4_update_vector_64 (md4_ctx_vector_t *md4_ctx, u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], const int len)
{
const int pos = md4_ctx->len & 0x3f;
md4_ctx->len += len;
if ((pos + len) < 64)
{
switch_buffer_by_offset_le (w0, w1, w2, w3, pos);
md4_ctx->w0[0] |= w0[0];
md4_ctx->w0[1] |= w0[1];
md4_ctx->w0[2] |= w0[2];
md4_ctx->w0[3] |= w0[3];
md4_ctx->w1[0] |= w1[0];
md4_ctx->w1[1] |= w1[1];
md4_ctx->w1[2] |= w1[2];
md4_ctx->w1[3] |= w1[3];
md4_ctx->w2[0] |= w2[0];
md4_ctx->w2[1] |= w2[1];
md4_ctx->w2[2] |= w2[2];
md4_ctx->w2[3] |= w2[3];
md4_ctx->w3[0] |= w3[0];
md4_ctx->w3[1] |= w3[1];
md4_ctx->w3[2] |= w3[2];
md4_ctx->w3[3] |= w3[3];
}
else
{
u32x c0[4] = { 0 };
u32x c1[4] = { 0 };
u32x c2[4] = { 0 };
u32x c3[4] = { 0 };
switch_buffer_by_offset_carry_le (w0, w1, w2, w3, c0, c1, c2, c3, pos);
md4_ctx->w0[0] |= w0[0];
md4_ctx->w0[1] |= w0[1];
md4_ctx->w0[2] |= w0[2];
md4_ctx->w0[3] |= w0[3];
md4_ctx->w1[0] |= w1[0];
md4_ctx->w1[1] |= w1[1];
md4_ctx->w1[2] |= w1[2];
md4_ctx->w1[3] |= w1[3];
md4_ctx->w2[0] |= w2[0];
md4_ctx->w2[1] |= w2[1];
md4_ctx->w2[2] |= w2[2];
md4_ctx->w2[3] |= w2[3];
md4_ctx->w3[0] |= w3[0];
md4_ctx->w3[1] |= w3[1];
md4_ctx->w3[2] |= w3[2];
md4_ctx->w3[3] |= w3[3];
md4_transform_vector (md4_ctx->w0, md4_ctx->w1, md4_ctx->w2, md4_ctx->w3, md4_ctx->h);
md4_ctx->w0[0] = c0[0];
md4_ctx->w0[1] = c0[1];
md4_ctx->w0[2] = c0[2];
md4_ctx->w0[3] = c0[3];
md4_ctx->w1[0] = c1[0];
md4_ctx->w1[1] = c1[1];
md4_ctx->w1[2] = c1[2];
md4_ctx->w1[3] = c1[3];
md4_ctx->w2[0] = c2[0];
md4_ctx->w2[1] = c2[1];
md4_ctx->w2[2] = c2[2];
md4_ctx->w2[3] = c2[3];
md4_ctx->w3[0] = c3[0];
md4_ctx->w3[1] = c3[1];
md4_ctx->w3[2] = c3[2];
md4_ctx->w3[3] = c3[3];
}
}
void md4_update_vector (md4_ctx_vector_t *md4_ctx, const u32x *w, const int len)
{
u32x w0[4];
u32x w1[4];
u32x w2[4];
u32x w3[4];
int i;
int j;
for (i = 0, j = 0; i < len - 64; i += 64, j += 16)
{
w0[0] = w[i + 0];
w0[1] = w[i + 1];
w0[2] = w[i + 2];
w0[3] = w[i + 3];
w1[0] = w[i + 4];
w1[1] = w[i + 5];
w1[2] = w[i + 6];
w1[3] = w[i + 7];
w2[0] = w[i + 8];
w2[1] = w[i + 9];
w2[2] = w[i + 10];
w2[3] = w[i + 11];
w3[0] = w[i + 12];
w3[1] = w[i + 13];
w3[2] = w[i + 14];
w3[3] = w[i + 15];
md4_update_vector_64 (md4_ctx, w0, w1, w2, w3, 64);
}
w0[0] = w[i + 0];
w0[1] = w[i + 1];
w0[2] = w[i + 2];
w0[3] = w[i + 3];
w1[0] = w[i + 4];
w1[1] = w[i + 5];
w1[2] = w[i + 6];
w1[3] = w[i + 7];
w2[0] = w[i + 8];
w2[1] = w[i + 9];
w2[2] = w[i + 10];
w2[3] = w[i + 11];
w3[0] = w[i + 12];
w3[1] = w[i + 13];
w3[2] = w[i + 14];
w3[3] = w[i + 15];
md4_update_vector_64 (md4_ctx, w0, w1, w2, w3, len & 0x3f);
}
void md4_final_vector (md4_ctx_vector_t *md4_ctx)
{
const int pos = md4_ctx->len & 0x3f;
append_0x80_4x4 (md4_ctx->w0, md4_ctx->w1, md4_ctx->w2, md4_ctx->w3, pos);
if (pos >= 56)
{
md4_transform_vector (md4_ctx->w0, md4_ctx->w1, md4_ctx->w2, md4_ctx->w3, md4_ctx->h);
md4_ctx->w0[0] = 0;
md4_ctx->w0[1] = 0;
md4_ctx->w0[2] = 0;
md4_ctx->w0[3] = 0;
md4_ctx->w1[0] = 0;
md4_ctx->w1[1] = 0;
md4_ctx->w1[2] = 0;
md4_ctx->w1[3] = 0;
md4_ctx->w2[0] = 0;
md4_ctx->w2[1] = 0;
md4_ctx->w2[2] = 0;
md4_ctx->w2[3] = 0;
md4_ctx->w3[0] = 0;
md4_ctx->w3[1] = 0;
md4_ctx->w3[2] = 0;
md4_ctx->w3[3] = 0;
}
md4_ctx->w3[2] = md4_ctx->len * 8;
md4_transform_vector (md4_ctx->w0, md4_ctx->w1, md4_ctx->w2, md4_ctx->w3, md4_ctx->h);
}
void md4_optimize_max_length_vector (md4_ctx_vector_t *md4_ctx, const int bits)
{
md4_ctx->len &= (1 << bits) - 1;
}

@ -11,6 +11,7 @@
#include "inc_types.cl"
#include "inc_common.cl"
#include "inc_simd.cl"
#include "inc_hash_md4.cl"
#define COMPARE_S "inc_comp_single.cl"
#define COMPARE_M "inc_comp_multi.cl"
@ -470,113 +471,51 @@ __kernel void m02100_init (__global pw_t *pws, __global const kernel_rule_t *rul
if (gid >= gid_max) return;
u32 w0[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];
md4_ctx_scalar_t md4_ctx1;
u32 w1[4];
md4_init_scalar (&md4_ctx1);
w1[0] = pws[gid].i[ 4];
w1[1] = pws[gid].i[ 5];
w1[2] = pws[gid].i[ 6];
w1[3] = pws[gid].i[ 7];
md4_update_scalar_global_utf16le (&md4_ctx1, pws[gid].i, pws[gid].pw_len);
u32 w2[4];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
u32 w3[4];
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
const u32 pw_len = pws[gid].pw_len;
md4_final_scalar (&md4_ctx1);
/**
* salt
*/
u32 salt_len = salt_bufs[salt_pos].salt_len;
u32 salt_buf0[4];
u32 salt_buf1[4];
u32 salt_buf2[4];
salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
salt_buf0[3] = salt_bufs[salt_pos].salt_buf[3];
salt_buf1[0] = salt_bufs[salt_pos].salt_buf[4];
salt_buf1[1] = salt_bufs[salt_pos].salt_buf[5];
salt_buf1[2] = salt_bufs[salt_pos].salt_buf[6];
salt_buf1[3] = salt_bufs[salt_pos].salt_buf[7];
salt_buf2[0] = salt_bufs[salt_pos].salt_buf[8];
salt_buf2[1] = salt_bufs[salt_pos].salt_buf[9];
salt_buf2[2] = 0;
salt_buf2[3] = 0;
md4_ctx_scalar_t md4_ctx2;
/**
* generate dcc
*/
md4_init_scalar (&md4_ctx2);
append_0x80_4x4_S (w0, w1, w2, w3, pw_len);
make_utf16le_S (w1, w2, w3);
make_utf16le_S (w0, w0, w1);
w3[2] = pw_len * 2 * 8;
u32 digest_md4[4];
digest_md4[0] = MD4M_A;
digest_md4[1] = MD4M_B;
digest_md4[2] = MD4M_C;
digest_md4[3] = MD4M_D;
md4_transform_S (w0, w1, w2, w3, digest_md4);
w0[0] = digest_md4[0];
w0[1] = digest_md4[1];
w0[2] = digest_md4[2];
w0[3] = digest_md4[3];
w1[0] = salt_buf0[0];
w1[1] = salt_buf0[1];
w1[2] = salt_buf0[2];
w1[3] = salt_buf0[3];
w2[0] = salt_buf1[0];
w2[1] = salt_buf1[1];
w2[2] = salt_buf1[2];
w2[3] = salt_buf1[3];
w3[0] = salt_buf2[0];
w3[1] = salt_buf2[1];
w3[2] = (16 + salt_len) * 8;
w3[3] = 0;
md4_ctx2.w0[0] = md4_ctx1.h[0];
md4_ctx2.w0[1] = md4_ctx1.h[1];
md4_ctx2.w0[2] = md4_ctx1.h[2];
md4_ctx2.w0[3] = md4_ctx1.h[3];
md4_ctx2.len = 16;
append_0x80_4x4_S (w0, w1, w2, w3, 16 + salt_len);
md4_update_scalar_global (&md4_ctx2, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
digest_md4[0] = MD4M_A;
digest_md4[1] = MD4M_B;
digest_md4[2] = MD4M_C;
digest_md4[3] = MD4M_D;
md4_final_scalar (&md4_ctx2);
md4_transform_S (w0, w1, w2, w3, digest_md4);
md4_ctx2.h[0] = swap32_S (md4_ctx2.h[0]);
md4_ctx2.h[1] = swap32_S (md4_ctx2.h[1]);
md4_ctx2.h[2] = swap32_S (md4_ctx2.h[2]);
md4_ctx2.h[3] = swap32_S (md4_ctx2.h[3]);
/**
* pads
*/
w0[0] = swap32_S (digest_md4[0]);
w0[1] = swap32_S (digest_md4[1]);
w0[2] = swap32_S (digest_md4[2]);
w0[3] = swap32_S (digest_md4[3]);
u32 w0[4];
u32 w1[4];
u32 w2[4];
u32 w3[4];
w0[0] = md4_ctx2.h[0];
w0[1] = md4_ctx2.h[1];
w0[2] = md4_ctx2.h[2];
w0[3] = md4_ctx2.h[3];
w1[0] = 0;
w1[1] = 0;
w1[2] = 0;
@ -611,19 +550,21 @@ __kernel void m02100_init (__global pw_t *pws, __global const kernel_rule_t *rul
* hmac1
*/
w0[0] = salt_buf0[0];
w0[1] = salt_buf0[1];
w0[2] = salt_buf0[2];
w0[3] = salt_buf0[3];
w1[0] = salt_buf1[0];
w1[1] = salt_buf1[1];
w1[2] = salt_buf1[2];
w1[3] = salt_buf1[3];
w2[0] = salt_buf2[0];
w2[1] = salt_buf2[1];
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
const u32 salt_len = salt_bufs[salt_pos].salt_len;
w0[0] = salt_bufs[salt_pos].salt_buf[ 0];
w0[1] = salt_bufs[salt_pos].salt_buf[ 1];
w0[2] = salt_bufs[salt_pos].salt_buf[ 2];
w0[3] = salt_bufs[salt_pos].salt_buf[ 3];
w1[0] = salt_bufs[salt_pos].salt_buf[ 4];
w1[1] = salt_bufs[salt_pos].salt_buf[ 5];
w1[2] = salt_bufs[salt_pos].salt_buf[ 6];
w1[3] = salt_bufs[salt_pos].salt_buf[ 7];
w2[0] = salt_bufs[salt_pos].salt_buf[ 8];
w2[1] = salt_bufs[salt_pos].salt_buf[ 9];
w2[2] = salt_bufs[salt_pos].salt_buf[10];
w2[3] = salt_bufs[salt_pos].salt_buf[11];
w3[0] = salt_bufs[salt_pos].salt_buf[12];
w3[1] = 0;
w3[2] = 0;
w3[3] = (64 + salt_len + 4) * 8;

@ -326,25 +326,27 @@ typedef enum salt_type
typedef enum opti_type
{
OPTI_TYPE_ZERO_BYTE = (1 << 1),
OPTI_TYPE_PRECOMPUTE_INIT = (1 << 2),
OPTI_TYPE_PRECOMPUTE_MERKLE = (1 << 3),
OPTI_TYPE_PRECOMPUTE_PERMUT = (1 << 4),
OPTI_TYPE_MEET_IN_MIDDLE = (1 << 5),
OPTI_TYPE_EARLY_SKIP = (1 << 6),
OPTI_TYPE_NOT_SALTED = (1 << 7),
OPTI_TYPE_NOT_ITERATED = (1 << 8),
OPTI_TYPE_PREPENDED_SALT = (1 << 9),
OPTI_TYPE_APPENDED_SALT = (1 << 10),
OPTI_TYPE_SINGLE_HASH = (1 << 11),
OPTI_TYPE_SINGLE_SALT = (1 << 12),
OPTI_TYPE_BRUTE_FORCE = (1 << 13),
OPTI_TYPE_RAW_HASH = (1 << 14),
OPTI_TYPE_SLOW_HASH_SIMD = (1 << 15),
OPTI_TYPE_USES_BITS_8 = (1 << 16),
OPTI_TYPE_USES_BITS_16 = (1 << 17),
OPTI_TYPE_USES_BITS_32 = (1 << 18),
OPTI_TYPE_USES_BITS_64 = (1 << 19)
OPTI_TYPE_ZERO_BYTE = (1 << 1),
OPTI_TYPE_PRECOMPUTE_INIT = (1 << 2),
OPTI_TYPE_PRECOMPUTE_MERKLE = (1 << 3),
OPTI_TYPE_PRECOMPUTE_PERMUT = (1 << 4),
OPTI_TYPE_MEET_IN_MIDDLE = (1 << 5),
OPTI_TYPE_EARLY_SKIP = (1 << 6),
OPTI_TYPE_NOT_SALTED = (1 << 7),
OPTI_TYPE_NOT_ITERATED = (1 << 8),
OPTI_TYPE_PREPENDED_SALT = (1 << 9),
OPTI_TYPE_APPENDED_SALT = (1 << 10),
OPTI_TYPE_SINGLE_HASH = (1 << 11),
OPTI_TYPE_SINGLE_SALT = (1 << 12),
OPTI_TYPE_BRUTE_FORCE = (1 << 13),
OPTI_TYPE_RAW_HASH = (1 << 14),
OPTI_TYPE_SLOW_HASH_SIMD_INIT = (1 << 15),
OPTI_TYPE_SLOW_HASH_SIMD_LOOP = (1 << 16),
OPTI_TYPE_SLOW_HASH_SIMD_COMP = (1 << 17),
OPTI_TYPE_USES_BITS_8 = (1 << 18),
OPTI_TYPE_USES_BITS_16 = (1 << 19),
OPTI_TYPE_USES_BITS_32 = (1 << 20),
OPTI_TYPE_USES_BITS_64 = (1 << 21)
} opti_type_t;

@ -262,25 +262,27 @@ static char ST_HASH_15600[] = "$ethereum$p*1024*38353131353831333338313138363430
static char ST_HASH_15700[] = "$ethereum$s*1024*1*1*3033363133373132373638333437323331383637383437333631373038323434*69eaf081695cf971ef7ee5a49997c1a3922e7efef59068109e83853755ee31c3*64a1adec1750ee4416b22b81111dd2a3c2fede820d6da8bf788dca2641d5b181";
static char ST_HASH_99999[] = "hashcat";
static const char OPTI_STR_ZERO_BYTE[] = "Zero-Byte";
static const char OPTI_STR_PRECOMPUTE_INIT[] = "Precompute-Init";
static const char OPTI_STR_PRECOMPUTE_MERKLE[] = "Precompute-Merkle-Demgard";
static const char OPTI_STR_PRECOMPUTE_PERMUT[] = "Precompute-Final-Permutation";
static const char OPTI_STR_MEET_IN_MIDDLE[] = "Meet-In-The-Middle";
static const char OPTI_STR_EARLY_SKIP[] = "Early-Skip";
static const char OPTI_STR_NOT_SALTED[] = "Not-Salted";
static const char OPTI_STR_NOT_ITERATED[] = "Not-Iterated";
static const char OPTI_STR_PREPENDED_SALT[] = "Prepended-Salt";
static const char OPTI_STR_APPENDED_SALT[] = "Appended-Salt";
static const char OPTI_STR_SINGLE_HASH[] = "Single-Hash";
static const char OPTI_STR_SINGLE_SALT[] = "Single-Salt";
static const char OPTI_STR_BRUTE_FORCE[] = "Brute-Force";
static const char OPTI_STR_RAW_HASH[] = "Raw-Hash";
static const char OPTI_STR_SLOW_HASH_SIMD[] = "Slow-Hash-SIMD";
static const char OPTI_STR_USES_BITS_8[] = "Uses-8-Bit";
static const char OPTI_STR_USES_BITS_16[] = "Uses-16-Bit";
static const char OPTI_STR_USES_BITS_32[] = "Uses-32-Bit";
static const char OPTI_STR_USES_BITS_64[] = "Uses-64-Bit";
static const char OPTI_STR_ZERO_BYTE[] = "Zero-Byte";
static const char OPTI_STR_PRECOMPUTE_INIT[] = "Precompute-Init";
static const char OPTI_STR_PRECOMPUTE_MERKLE[] = "Precompute-Merkle-Demgard";
static const char OPTI_STR_PRECOMPUTE_PERMUT[] = "Precompute-Final-Permutation";
static const char OPTI_STR_MEET_IN_MIDDLE[] = "Meet-In-The-Middle";
static const char OPTI_STR_EARLY_SKIP[] = "Early-Skip";
static const char OPTI_STR_NOT_SALTED[] = "Not-Salted";
static const char OPTI_STR_NOT_ITERATED[] = "Not-Iterated";
static const char OPTI_STR_PREPENDED_SALT[] = "Prepended-Salt";
static const char OPTI_STR_APPENDED_SALT[] = "Appended-Salt";
static const char OPTI_STR_SINGLE_HASH[] = "Single-Hash";
static const char OPTI_STR_SINGLE_SALT[] = "Single-Salt";
static const char OPTI_STR_BRUTE_FORCE[] = "Brute-Force";
static const char OPTI_STR_RAW_HASH[] = "Raw-Hash";
static const char OPTI_STR_SLOW_HASH_SIMD_INIT[] = "Slow-Hash-SIMD-INIT";
static const char OPTI_STR_SLOW_HASH_SIMD_LOOP[] = "Slow-Hash-SIMD-LOOP";
static const char OPTI_STR_SLOW_HASH_SIMD_COMP[] = "Slow-Hash-SIMD-COMP";
static const char OPTI_STR_USES_BITS_8[] = "Uses-8-Bit";
static const char OPTI_STR_USES_BITS_16[] = "Uses-16-Bit";
static const char OPTI_STR_USES_BITS_32[] = "Uses-32-Bit";
static const char OPTI_STR_USES_BITS_64[] = "Uses-64-Bit";
static const char PA_000[] = "OK";
static const char PA_001[] = "Ignored due to comment";
@ -15671,25 +15673,27 @@ char *stroptitype (const u32 opti_type)
{
switch (opti_type)
{
case OPTI_TYPE_ZERO_BYTE: return ((char *) OPTI_STR_ZERO_BYTE);
case OPTI_TYPE_PRECOMPUTE_INIT: return ((char *) OPTI_STR_PRECOMPUTE_INIT);
case OPTI_TYPE_PRECOMPUTE_MERKLE: return ((char *) OPTI_STR_PRECOMPUTE_MERKLE);
case OPTI_TYPE_PRECOMPUTE_PERMUT: return ((char *) OPTI_STR_PRECOMPUTE_PERMUT);
case OPTI_TYPE_MEET_IN_MIDDLE: return ((char *) OPTI_STR_MEET_IN_MIDDLE);
case OPTI_TYPE_EARLY_SKIP: return ((char *) OPTI_STR_EARLY_SKIP);
case OPTI_TYPE_NOT_SALTED: return ((char *) OPTI_STR_NOT_SALTED);
case OPTI_TYPE_NOT_ITERATED: return ((char *) OPTI_STR_NOT_ITERATED);
case OPTI_TYPE_PREPENDED_SALT: return ((char *) OPTI_STR_PREPENDED_SALT);
case OPTI_TYPE_APPENDED_SALT: return ((char *) OPTI_STR_APPENDED_SALT);
case OPTI_TYPE_SINGLE_HASH: return ((char *) OPTI_STR_SINGLE_HASH);
case OPTI_TYPE_SINGLE_SALT: return ((char *) OPTI_STR_SINGLE_SALT);
case OPTI_TYPE_BRUTE_FORCE: return ((char *) OPTI_STR_BRUTE_FORCE);
case OPTI_TYPE_RAW_HASH: return ((char *) OPTI_STR_RAW_HASH);
case OPTI_TYPE_SLOW_HASH_SIMD: return ((char *) OPTI_STR_SLOW_HASH_SIMD);
case OPTI_TYPE_USES_BITS_8: return ((char *) OPTI_STR_USES_BITS_8);
case OPTI_TYPE_USES_BITS_16: return ((char *) OPTI_STR_USES_BITS_16);
case OPTI_TYPE_USES_BITS_32: return ((char *) OPTI_STR_USES_BITS_32);
case OPTI_TYPE_USES_BITS_64: return ((char *) OPTI_STR_USES_BITS_64);
case OPTI_TYPE_ZERO_BYTE: return ((char *) OPTI_STR_ZERO_BYTE);
case OPTI_TYPE_PRECOMPUTE_INIT: return ((char *) OPTI_STR_PRECOMPUTE_INIT);
case OPTI_TYPE_PRECOMPUTE_MERKLE: return ((char *) OPTI_STR_PRECOMPUTE_MERKLE);
case OPTI_TYPE_PRECOMPUTE_PERMUT: return ((char *) OPTI_STR_PRECOMPUTE_PERMUT);
case OPTI_TYPE_MEET_IN_MIDDLE: return ((char *) OPTI_STR_MEET_IN_MIDDLE);
case OPTI_TYPE_EARLY_SKIP: return ((char *) OPTI_STR_EARLY_SKIP);
case OPTI_TYPE_NOT_SALTED: return ((char *) OPTI_STR_NOT_SALTED);
case OPTI_TYPE_NOT_ITERATED: return ((char *) OPTI_STR_NOT_ITERATED);
case OPTI_TYPE_PREPENDED_SALT: return ((char *) OPTI_STR_PREPENDED_SALT);
case OPTI_TYPE_APPENDED_SALT: return ((char *) OPTI_STR_APPENDED_SALT);
case OPTI_TYPE_SINGLE_HASH: return ((char *) OPTI_STR_SINGLE_HASH);
case OPTI_TYPE_SINGLE_SALT: return ((char *) OPTI_STR_SINGLE_SALT);
case OPTI_TYPE_BRUTE_FORCE: return ((char *) OPTI_STR_BRUTE_FORCE);
case OPTI_TYPE_RAW_HASH: return ((char *) OPTI_STR_RAW_HASH);
case OPTI_TYPE_SLOW_HASH_SIMD_INIT: return ((char *) OPTI_STR_SLOW_HASH_SIMD_INIT);
case OPTI_TYPE_SLOW_HASH_SIMD_LOOP: return ((char *) OPTI_STR_SLOW_HASH_SIMD_LOOP);
case OPTI_TYPE_SLOW_HASH_SIMD_COMP: return ((char *) OPTI_STR_SLOW_HASH_SIMD_COMP);
case OPTI_TYPE_USES_BITS_8: return ((char *) OPTI_STR_USES_BITS_8);
case OPTI_TYPE_USES_BITS_16: return ((char *) OPTI_STR_USES_BITS_16);
case OPTI_TYPE_USES_BITS_32: return ((char *) OPTI_STR_USES_BITS_32);
case OPTI_TYPE_USES_BITS_64: return ((char *) OPTI_STR_USES_BITS_64);
}
return (NULL);
@ -20332,7 +20336,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_4;
hashconfig->parse_func = phpass_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -21047,7 +21051,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_4;
hashconfig->parse_func = dcc2_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -21106,7 +21110,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_4;
hashconfig->parse_func = wpa_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -22156,7 +22160,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->parse_func = sha512osx_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_USES_BITS_64
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -22174,7 +22178,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->parse_func = sha512grub_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_USES_BITS_64
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -22520,7 +22524,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_32;
hashconfig->parse_func = cisco8_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -22740,7 +22744,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_32;
hashconfig->parse_func = djangopbkdf2_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -22948,7 +22952,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_32;
hashconfig->parse_func = pbkdf2_sha256_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -23131,7 +23135,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_32;
hashconfig->parse_func = pbkdf2_md5_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -23150,7 +23154,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_32;
hashconfig->parse_func = pbkdf2_sha1_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -23168,7 +23172,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_32;
hashconfig->parse_func = atlassian_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -23188,7 +23192,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->parse_func = pbkdf2_sha512_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_USES_BITS_64
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -23892,7 +23896,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_4; // we actually do not have a digest
hashconfig->parse_func = itunes_backup_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -23913,7 +23917,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_4; // we actually do not have a digest
hashconfig->parse_func = itunes_backup_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;
@ -24060,7 +24064,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->dgst_size = DGST_SIZE_4_8;
hashconfig->parse_func = ethereum_pbkdf2_parse_hash;
hashconfig->opti_type = OPTI_TYPE_ZERO_BYTE
| OPTI_TYPE_SLOW_HASH_SIMD;
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
hashconfig->dgst_pos0 = 0;
hashconfig->dgst_pos1 = 1;
hashconfig->dgst_pos2 = 2;

@ -1402,9 +1402,23 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con
}
else
{
if (kern_run == KERN_RUN_2)
if (kern_run == KERN_RUN_1)
{
if (hashconfig->opti_type & OPTI_TYPE_SLOW_HASH_SIMD)
if (hashconfig->opti_type & OPTI_TYPE_SLOW_HASH_SIMD_INIT)
{
num_elements = CEILDIV (num_elements, device_param->vector_width);
}
}
else if (kern_run == KERN_RUN_2)
{
if (hashconfig->opti_type & OPTI_TYPE_SLOW_HASH_SIMD_LOOP)
{
num_elements = CEILDIV (num_elements, device_param->vector_width);
}
}
else if (kern_run == KERN_RUN_3)
{
if (hashconfig->opti_type & OPTI_TYPE_SLOW_HASH_SIMD_COMP)
{
num_elements = CEILDIV (num_elements, device_param->vector_width);
}

Loading…
Cancel
Save