1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-09 15:20:59 +00:00

Format code using GNU Indent

Co-Authored-By: SQL master <bnzm5270@gmail.com>
This commit is contained in:
Devin AI 2024-12-13 17:08:11 +00:00
parent 2b7a728d52
commit 3db39cfde8

View File

@ -107,29 +107,19 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u32 *digest = (const u32 *) digest_buf; const u32 *digest = (const u32 *) digest_buf;
// Format: hash:salt in hex format matching Python example // Format: hash:salt in hex format matching Python example
char tmp_buf[BLOCK_SIZE] = { 0 }; u8 *out_buf = (u8 *) line_buf;
int offset = 0; int out_len = 0;
// Convert hash to hex (16 bytes MD5) u32_to_hex (digest[0], out_buf + out_len); out_len += 8;
for (int i = 0; i < 16; i++) u32_to_hex (digest[1], out_buf + out_len); out_len += 8;
{ u32_to_hex (digest[2], out_buf + out_len); out_len += 8;
const u8 *ptr = (const u8 *) digest + i; u32_to_hex (digest[3], out_buf + out_len); out_len += 8;
snprintf (tmp_buf + offset, BLOCK_SIZE - offset, "%02x", *ptr);
offset += 2;
}
// Add separator out_buf[out_len] = hashconfig->separator;
tmp_buf[offset++] = ':'; out_len += 1;
// Convert salt to hex (4 bytes) u8_to_hex ((const u8 *) salt->salt_buf, 4, out_buf + out_len);
for (int i = 0; i < 4; i++) out_len += 8;
{
const u8 *ptr = (const u8 *) salt->salt_buf + i;
snprintf (tmp_buf + offset, BLOCK_SIZE - offset, "%02x", *ptr);
offset += 2;
}
const int out_len = snprintf (line_buf, line_size, "%s", tmp_buf);
return out_len; return out_len;
} }