1
mirror of https://github.com/hashcat/hashcat synced 2024-11-20 23:27:31 +01:00

Precompute some steps in 3des to improve cracking performance

This commit is contained in:
Jens Steube 2020-02-21 15:10:27 +01:00
parent 398e06878d
commit cd20e43667

View File

@ -549,6 +549,26 @@ DECLSPEC void m14100m (LOCAL_AS u32 (*s_SPtrans)[64], LOCAL_AS u32 (*s_skb)[64],
salt_buf0[0] = salt_bufs[salt_pos].salt_buf_pc[0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf_pc[1];
/**
* Precompute fixed key scheduler
*/
const u32x c = (w[2]);
const u32x d = (w[3]);
u32x Kc[16];
u32x Kd[16];
_des_crypt_keysetup (c, d, Kc, Kd, s_skb);
const u32x e = (w[4]);
const u32x f = (w[5]);
u32x Ke[16];
u32x Kf[16];
_des_crypt_keysetup (e, f, Ke, Kf, s_skb);
/**
* loop
*/
@ -584,28 +604,12 @@ DECLSPEC void m14100m (LOCAL_AS u32 (*s_SPtrans)[64], LOCAL_AS u32 (*s_skb)[64],
/* Second Pass */
const u32x c = (w[2]);
const u32x d = (w[3]);
u32x Kc[16];
u32x Kd[16];
_des_crypt_keysetup (c, d, Kc, Kd, s_skb);
u32x p2[2];
_des_crypt_decrypt (p2, p1, Kc, Kd, s_SPtrans);
/* Third Pass */
const u32x e = (w[4]);
const u32x f = (w[5]);
u32x Ke[16];
u32x Kf[16];
_des_crypt_keysetup (e, f, Ke, Kf, s_skb);
u32x iv[2];
_des_crypt_encrypt (iv, p2, Ke, Kf, s_SPtrans);
@ -634,14 +638,47 @@ DECLSPEC void m14100s (LOCAL_AS u32 (*s_SPtrans)[64], LOCAL_AS u32 (*s_skb)[64],
salt_buf0[0] = salt_bufs[salt_pos].salt_buf_pc[0];
salt_buf0[1] = salt_bufs[salt_pos].salt_buf_pc[1];
/**
* Precompute fixed key scheduler
*/
u32x iv[2];
iv[0] = digests_buf[digests_offset].digest_buf[0];
iv[1] = digests_buf[digests_offset].digest_buf[1];
const u32x e = (w[4]);
const u32x f = (w[5]);
u32x Ke[16];
u32x Kf[16];
_des_crypt_keysetup (e, f, Ke, Kf, s_skb);
u32x p2[2];
_des_crypt_decrypt (p2, iv, Ke, Kf, s_SPtrans);
const u32x c = (w[2]);
const u32x d = (w[3]);
u32x Kc[16];
u32x Kd[16];
_des_crypt_keysetup (c, d, Kc, Kd, s_skb);
u32x p1[2];
_des_crypt_encrypt (p1, p2, Kc, Kd, s_SPtrans);
/**
* digest
*/
const u32 search[4] =
{
digests_buf[digests_offset].digest_buf[DGST_R0],
digests_buf[digests_offset].digest_buf[DGST_R1],
p1[0],
p1[1],
0,
0
};
@ -679,37 +716,13 @@ DECLSPEC void m14100s (LOCAL_AS u32 (*s_SPtrans)[64], LOCAL_AS u32 (*s_skb)[64],
_des_crypt_encrypt (p1, data, Ka, Kb, s_SPtrans);
/* Second Pass */
/* Second Pass was precomputed */
const u32x c = (w[2]);
const u32x d = (w[3]);
u32x Kc[16];
u32x Kd[16];
_des_crypt_keysetup (c, d, Kc, Kd, s_skb);
u32x p2[2];
_des_crypt_decrypt (p2, p1, Kc, Kd, s_SPtrans);
/* Third Pass */
const u32x e = (w[4]);
const u32x f = (w[5]);
u32x Ke[16];
u32x Kf[16];
_des_crypt_keysetup (e, f, Ke, Kf, s_skb);
u32x iv[2];
_des_crypt_encrypt (iv, p2, Ke, Kf, s_SPtrans);
/* Third Pass was precomputed */
u32x z = 0;
COMPARE_S_SIMD (iv[0], iv[1], z, z);
COMPARE_S_SIMD (p1[0], p1[1], z, z);
}
}