mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-11 16:21:12 +00:00
Switch hex_to_u64() to LE
This commit is contained in:
parent
f0b287e838
commit
ceed66d50b
@ -196,22 +196,22 @@ u64 hex_to_u64 (const u8 hex[16])
|
||||
{
|
||||
u64 v = 0;
|
||||
|
||||
v |= ((u64) hex_convert (hex[15]) << 0);
|
||||
v |= ((u64) hex_convert (hex[14]) << 4);
|
||||
v |= ((u64) hex_convert (hex[13]) << 8);
|
||||
v |= ((u64) hex_convert (hex[12]) << 12);
|
||||
v |= ((u64) hex_convert (hex[11]) << 16);
|
||||
v |= ((u64) hex_convert (hex[10]) << 20);
|
||||
v |= ((u64) hex_convert (hex[ 9]) << 24);
|
||||
v |= ((u64) hex_convert (hex[ 8]) << 28);
|
||||
v |= ((u64) hex_convert (hex[ 7]) << 32);
|
||||
v |= ((u64) hex_convert (hex[ 6]) << 36);
|
||||
v |= ((u64) hex_convert (hex[ 5]) << 40);
|
||||
v |= ((u64) hex_convert (hex[ 4]) << 44);
|
||||
v |= ((u64) hex_convert (hex[ 3]) << 48);
|
||||
v |= ((u64) hex_convert (hex[ 2]) << 52);
|
||||
v |= ((u64) hex_convert (hex[ 1]) << 56);
|
||||
v |= ((u64) hex_convert (hex[ 0]) << 60);
|
||||
v |= ((u64) hex_convert (hex[ 1]) << 0);
|
||||
v |= ((u64) hex_convert (hex[ 0]) << 4);
|
||||
v |= ((u64) hex_convert (hex[ 3]) << 8);
|
||||
v |= ((u64) hex_convert (hex[ 2]) << 12);
|
||||
v |= ((u64) hex_convert (hex[ 5]) << 16);
|
||||
v |= ((u64) hex_convert (hex[ 4]) << 20);
|
||||
v |= ((u64) hex_convert (hex[ 7]) << 24);
|
||||
v |= ((u64) hex_convert (hex[ 6]) << 28);
|
||||
v |= ((u64) hex_convert (hex[ 9]) << 32);
|
||||
v |= ((u64) hex_convert (hex[ 8]) << 36);
|
||||
v |= ((u64) hex_convert (hex[11]) << 40);
|
||||
v |= ((u64) hex_convert (hex[10]) << 44);
|
||||
v |= ((u64) hex_convert (hex[13]) << 48);
|
||||
v |= ((u64) hex_convert (hex[12]) << 52);
|
||||
v |= ((u64) hex_convert (hex[15]) << 56);
|
||||
v |= ((u64) hex_convert (hex[14]) << 60);
|
||||
|
||||
return (v);
|
||||
}
|
||||
|
@ -2328,6 +2328,15 @@ int osx512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU
|
||||
digest[6] = hex_to_u64 ((const u8 *) &hash_pos[ 96]);
|
||||
digest[7] = hex_to_u64 ((const u8 *) &hash_pos[112]);
|
||||
|
||||
digest[0] = byte_swap_64 (digest[0]);
|
||||
digest[1] = byte_swap_64 (digest[1]);
|
||||
digest[2] = byte_swap_64 (digest[2]);
|
||||
digest[3] = byte_swap_64 (digest[3]);
|
||||
digest[4] = byte_swap_64 (digest[4]);
|
||||
digest[5] = byte_swap_64 (digest[5]);
|
||||
digest[6] = byte_swap_64 (digest[6]);
|
||||
digest[7] = byte_swap_64 (digest[7]);
|
||||
|
||||
digest[0] -= SHA512M_A;
|
||||
digest[1] -= SHA512M_B;
|
||||
digest[2] -= SHA512M_C;
|
||||
@ -4454,6 +4463,15 @@ int mssql2012_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_
|
||||
digest[6] = hex_to_u64 ((const u8 *) &hash_pos[ 96]);
|
||||
digest[7] = hex_to_u64 ((const u8 *) &hash_pos[112]);
|
||||
|
||||
digest[0] = byte_swap_64 (digest[0]);
|
||||
digest[1] = byte_swap_64 (digest[1]);
|
||||
digest[2] = byte_swap_64 (digest[2]);
|
||||
digest[3] = byte_swap_64 (digest[3]);
|
||||
digest[4] = byte_swap_64 (digest[4]);
|
||||
digest[5] = byte_swap_64 (digest[5]);
|
||||
digest[6] = byte_swap_64 (digest[6]);
|
||||
digest[7] = byte_swap_64 (digest[7]);
|
||||
|
||||
digest[0] -= SHA512M_A;
|
||||
digest[1] -= SHA512M_B;
|
||||
digest[2] -= SHA512M_C;
|
||||
@ -4716,6 +4734,15 @@ int sha384_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU
|
||||
digest[6] = 0;
|
||||
digest[7] = 0;
|
||||
|
||||
digest[0] = byte_swap_64 (digest[0]);
|
||||
digest[1] = byte_swap_64 (digest[1]);
|
||||
digest[2] = byte_swap_64 (digest[2]);
|
||||
digest[3] = byte_swap_64 (digest[3]);
|
||||
digest[4] = byte_swap_64 (digest[4]);
|
||||
digest[5] = byte_swap_64 (digest[5]);
|
||||
digest[6] = 0;
|
||||
digest[7] = 0;
|
||||
|
||||
digest[0] -= SHA384M_A;
|
||||
digest[1] -= SHA384M_B;
|
||||
digest[2] -= SHA384M_C;
|
||||
@ -4745,6 +4772,15 @@ int sha512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU
|
||||
digest[6] = hex_to_u64 ((const u8 *) &input_buf[ 96]);
|
||||
digest[7] = hex_to_u64 ((const u8 *) &input_buf[112]);
|
||||
|
||||
digest[0] = byte_swap_64 (digest[0]);
|
||||
digest[1] = byte_swap_64 (digest[1]);
|
||||
digest[2] = byte_swap_64 (digest[2]);
|
||||
digest[3] = byte_swap_64 (digest[3]);
|
||||
digest[4] = byte_swap_64 (digest[4]);
|
||||
digest[5] = byte_swap_64 (digest[5]);
|
||||
digest[6] = byte_swap_64 (digest[6]);
|
||||
digest[7] = byte_swap_64 (digest[7]);
|
||||
|
||||
digest[0] -= SHA512M_A;
|
||||
digest[1] -= SHA512M_B;
|
||||
digest[2] -= SHA512M_C;
|
||||
@ -4783,6 +4819,15 @@ int sha512s_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
|
||||
digest[6] = hex_to_u64 ((const u8 *) &input_buf[ 96]);
|
||||
digest[7] = hex_to_u64 ((const u8 *) &input_buf[112]);
|
||||
|
||||
digest[0] = byte_swap_64 (digest[0]);
|
||||
digest[1] = byte_swap_64 (digest[1]);
|
||||
digest[2] = byte_swap_64 (digest[2]);
|
||||
digest[3] = byte_swap_64 (digest[3]);
|
||||
digest[4] = byte_swap_64 (digest[4]);
|
||||
digest[5] = byte_swap_64 (digest[5]);
|
||||
digest[6] = byte_swap_64 (digest[6]);
|
||||
digest[7] = byte_swap_64 (digest[7]);
|
||||
|
||||
digest[0] -= SHA512M_A;
|
||||
digest[1] -= SHA512M_B;
|
||||
digest[2] -= SHA512M_C;
|
||||
@ -4881,8 +4926,6 @@ int keccak_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU
|
||||
for (u32 i = 0; i < keccak_mdlen / 8; i++)
|
||||
{
|
||||
digest[i] = hex_to_u64 ((const u8 *) &input_buf[i * 16]);
|
||||
|
||||
digest[i] = byte_swap_64 (digest[i]);
|
||||
}
|
||||
|
||||
salt->keccak_mdlen = keccak_mdlen;
|
||||
@ -5865,6 +5908,15 @@ int sha512osx_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_
|
||||
digest[6] = hex_to_u64 ((const u8 *) &hash_pos[ 96]);
|
||||
digest[7] = hex_to_u64 ((const u8 *) &hash_pos[112]);
|
||||
|
||||
digest[0] = byte_swap_64 (digest[0]);
|
||||
digest[1] = byte_swap_64 (digest[1]);
|
||||
digest[2] = byte_swap_64 (digest[2]);
|
||||
digest[3] = byte_swap_64 (digest[3]);
|
||||
digest[4] = byte_swap_64 (digest[4]);
|
||||
digest[5] = byte_swap_64 (digest[5]);
|
||||
digest[6] = byte_swap_64 (digest[6]);
|
||||
digest[7] = byte_swap_64 (digest[7]);
|
||||
|
||||
u32 salt_len = hash_pos - salt_pos - 1;
|
||||
|
||||
if ((salt_len % 2) != 0) return (PARSER_SALT_LENGTH);
|
||||
@ -5996,6 +6048,15 @@ int sha512grub_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
|
||||
digest[6] = hex_to_u64 ((const u8 *) &hash_pos[ 96]);
|
||||
digest[7] = hex_to_u64 ((const u8 *) &hash_pos[112]);
|
||||
|
||||
digest[0] = byte_swap_64 (digest[0]);
|
||||
digest[1] = byte_swap_64 (digest[1]);
|
||||
digest[2] = byte_swap_64 (digest[2]);
|
||||
digest[3] = byte_swap_64 (digest[3]);
|
||||
digest[4] = byte_swap_64 (digest[4]);
|
||||
digest[5] = byte_swap_64 (digest[5]);
|
||||
digest[6] = byte_swap_64 (digest[6]);
|
||||
digest[7] = byte_swap_64 (digest[7]);
|
||||
|
||||
u32 salt_len = hash_pos - salt_pos - 1;
|
||||
|
||||
salt_len /= 2;
|
||||
@ -6228,6 +6289,15 @@ int hmacsha512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
|
||||
digest[6] = hex_to_u64 ((const u8 *) &input_buf[ 96]);
|
||||
digest[7] = hex_to_u64 ((const u8 *) &input_buf[112]);
|
||||
|
||||
digest[0] = byte_swap_64 (digest[0]);
|
||||
digest[1] = byte_swap_64 (digest[1]);
|
||||
digest[2] = byte_swap_64 (digest[2]);
|
||||
digest[3] = byte_swap_64 (digest[3]);
|
||||
digest[4] = byte_swap_64 (digest[4]);
|
||||
digest[5] = byte_swap_64 (digest[5]);
|
||||
digest[6] = byte_swap_64 (digest[6]);
|
||||
digest[7] = byte_swap_64 (digest[7]);
|
||||
|
||||
if (input_buf[128] != hashconfig->separator) return (PARSER_SEPARATOR_UNMATCHED);
|
||||
|
||||
u32 salt_len = input_len - 128 - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user