1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

Fix some format in -m 29600

This commit is contained in:
jsteube 2022-08-06 19:56:11 +00:00
parent 126830c378
commit 51b1744805

View File

@ -60,6 +60,7 @@ typedef struct terra
u32 salt_buf[8]; u32 salt_buf[8];
u32 ct[16]; // 16 * 4 = 64 bytes (we have extra 16 bytes in digest: 64 + 16 = 80) u32 ct[16]; // 16 * 4 = 64 bytes (we have extra 16 bytes in digest: 64 + 16 = 80)
u32 iv[4]; u32 iv[4];
} terra_t; } terra_t;
u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
@ -128,39 +129,41 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
// salt
const u8 *salt_pos = token.buf[0]; const u8 *salt_pos = token.buf[0];
const int salt_len = token.len[0]; const int salt_len = token.len[0];
const u8 *iv_pos = token.buf[1];
const int iv_len = token.len[1];
const u8 *hash_pos = token.buf[2];
const int hash_len = token.len[2];
// Populating salt buf even though it's unused - we use esalt below // Populating salt buf even though it's unused - we use esalt below
const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len); const bool parse_rc = generic_salt_decode (hashconfig, salt_pos, salt_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len);
if (parse_rc == false) return (PARSER_SALT_LENGTH); if (parse_rc == false) return (PARSER_SALT_LENGTH);
// Set the loop rounds - 1 round is done in the init function // Set the loop rounds - 1 round is done in the init function
salt->salt_iter = ROUNDS_PBKDF_SHA_TERRA - 1; salt->salt_iter = ROUNDS_PBKDF_SHA_TERRA - 1;
// Unhex the salt into the esalt buffer // Unhex the salt into the esalt buffer
if (salt_len != 32) return (PARSER_HASH_LENGTH); if (salt_len != 32) return (PARSER_HASH_LENGTH);
terra->salt_buf[0] = hex_to_u32 (salt_pos + 0); terra->salt_buf[0] = hex_to_u32 (salt_pos + 0);
terra->salt_buf[1] = hex_to_u32 (salt_pos + 8); terra->salt_buf[1] = hex_to_u32 (salt_pos + 8);
terra->salt_buf[2] = hex_to_u32 (salt_pos + 16); terra->salt_buf[2] = hex_to_u32 (salt_pos + 16);
terra->salt_buf[3] = hex_to_u32 (salt_pos + 24); terra->salt_buf[3] = hex_to_u32 (salt_pos + 24);
// store IV // store IV
const u8 *iv_pos = token.buf[1];
const int iv_len = token.len[1];
if (iv_len != 32) return (PARSER_SALT_LENGTH); if (iv_len != 32) return (PARSER_SALT_LENGTH);
terra->iv[0] = hex_to_u32 (iv_pos + 0); terra->iv[0] = hex_to_u32 (iv_pos + 0);
terra->iv[1] = hex_to_u32 (iv_pos + 8); terra->iv[1] = hex_to_u32 (iv_pos + 8);
terra->iv[2] = hex_to_u32 (iv_pos + 16); terra->iv[2] = hex_to_u32 (iv_pos + 16);
terra->iv[3] = hex_to_u32 (iv_pos + 24); terra->iv[3] = hex_to_u32 (iv_pos + 24);
// Base64 decode the ciphertext // Base64 decode the ciphertext
const u8 *hash_pos = token.buf[2];
const int hash_len = token.len[2];
u8 tmp_buf[512]; u8 tmp_buf[512];
int tmp_len; int tmp_len;
@ -168,13 +171,13 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (tmp_len != 0x50) return (PARSER_HASH_LENGTH); if (tmp_len != 0x50) return (PARSER_HASH_LENGTH);
u32* whole_digest = (u32*) tmp_buf; u32 *whole_digest = (u32 *) tmp_buf;
// Penultimate block, i.e. IV, xored with a whole padding block // Penultimate block, i.e. IV, xored with a whole padding block
terra->ct[0] = byte_swap_32(whole_digest[0xc] ^ 0x10101010); terra->ct[0] = byte_swap_32 (whole_digest[0xc] ^ 0x10101010);
terra->ct[1] = byte_swap_32(whole_digest[0xd] ^ 0x10101010); terra->ct[1] = byte_swap_32 (whole_digest[0xd] ^ 0x10101010);
terra->ct[2] = byte_swap_32(whole_digest[0xe] ^ 0x10101010); terra->ct[2] = byte_swap_32 (whole_digest[0xe] ^ 0x10101010);
terra->ct[3] = byte_swap_32(whole_digest[0xf] ^ 0x10101010); terra->ct[3] = byte_swap_32 (whole_digest[0xf] ^ 0x10101010);
for (int i = 4; i < 16; i++) for (int i = 4; i < 16; i++)
{ {