1
mirror of https://github.com/hashcat/hashcat synced 2024-11-28 05:21:38 +01:00

Support 64 bit timestamps properly

This commit is contained in:
unix-ninja 2018-10-19 15:35:52 -04:00
parent 770e21e5ee
commit fddfd835d2
4 changed files with 13 additions and 10 deletions

View File

@ -32,7 +32,7 @@ __kernel void m18100_mxx (__global pw_t *pws, __constant const kernel_rule_t *ru
COPY_PW (pws[gid]); COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len; const u32 salt_len = 8;
u32 s[64] = { 0 }; u32 s[64] = { 0 };
@ -125,7 +125,7 @@ __kernel void m18100_sxx (__global pw_t *pws, __constant const kernel_rule_t *ru
COPY_PW (pws[gid]); COPY_PW (pws[gid]);
const u32 salt_len = salt_bufs[salt_pos].salt_len; const u32 salt_len = 8;
u32 s[64] = { 0 }; u32 s[64] = { 0 };

View File

@ -37,7 +37,7 @@ __kernel void m18100_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
w[idx] = swap32_S (pws[gid].i[idx]); w[idx] = swap32_S (pws[gid].i[idx]);
} }
const u32 salt_len = salt_bufs[salt_pos].salt_len; const u32 salt_len = 8;
u32 s[64] = { 0 }; u32 s[64] = { 0 };
@ -155,7 +155,7 @@ __kernel void m18100_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
w[idx] = swap32_S (pws[gid].i[idx]); w[idx] = swap32_S (pws[gid].i[idx]);
} }
const u32 salt_len = salt_bufs[salt_pos].salt_len; const u32 salt_len = 8;
u32 s[64] = { 0 }; u32 s[64] = { 0 };

View File

@ -37,7 +37,7 @@ __kernel void m18100_mxx (__global pw_t *pws, __global const kernel_rule_t *rule
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
const u32 salt_len = salt_bufs[salt_pos].salt_len; const u32 salt_len = 8;
u32x s[64] = { 0 }; u32x s[64] = { 0 };
@ -141,7 +141,7 @@ __kernel void m18100_sxx (__global pw_t *pws, __global const kernel_rule_t *rule
w[idx] = pws[gid].i[idx]; w[idx] = pws[gid].i[idx];
} }
const u32 salt_len = salt_bufs[salt_pos].salt_len; const u32 salt_len = 8;
u32x s[64] = { 0 }; u32x s[64] = { 0 };

View File

@ -5201,6 +5201,10 @@ int totp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
// convert ascii timestamp to ulong timestamp // convert ascii timestamp to ulong timestamp
u64 timestamp = hc_strtoull ((const char *) salt_pos, NULL, 10); u64 timestamp = hc_strtoull ((const char *) salt_pos, NULL, 10);
// store the original salt value. Step division will destroy granularity for output
salt->salt_buf[3] = ((u32) (timestamp >> 0));
salt->salt_buf[2] = ((u32) (timestamp >> 32));
// divide our timestamp by our step. We will use the RFC 6238 default of 30 for now // divide our timestamp by our step. We will use the RFC 6238 default of 30 for now
timestamp /= 30; timestamp /= 30;
@ -5208,8 +5212,8 @@ int totp_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
salt->salt_buf[1] = byte_swap_32 ((u32) (timestamp >> 0)); salt->salt_buf[1] = byte_swap_32 ((u32) (timestamp >> 0));
salt->salt_buf[0] = byte_swap_32 ((u32) (timestamp >> 32)); salt->salt_buf[0] = byte_swap_32 ((u32) (timestamp >> 32));
// our salt will always be 8 bytes // our salt will always be 8 bytes, but we are going to cheat and store it twice, so...
salt->salt_len = 8; salt->salt_len = 16;
return (PARSER_OK); return (PARSER_OK);
} }
@ -22331,8 +22335,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
// we also need to multiply salt by our step to see the floor of our original timestamp range. // we also need to multiply salt by our step to see the floor of our original timestamp range.
// again, we will use the default RFC 6238 step of 30. // again, we will use the default RFC 6238 step of 30.
u64 tmp_salt_buf = (((u64) byte_swap_32 (salt.salt_buf[0])) << 32) | ((u64) byte_swap_32 (salt.salt_buf[1])); u64 tmp_salt_buf = (((u64) (salt.salt_buf[2])) << 32) | ((u64) (salt.salt_buf[3]));
tmp_salt_buf *= 30;
snprintf (out_buf, out_len - 1, "%06d:%llu", digest_buf[1], tmp_salt_buf); snprintf (out_buf, out_len - 1, "%06d:%llu", digest_buf[1], tmp_salt_buf);
} }