1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-27 17:08:12 +00:00

Switch hex_to_u32() to LE

Also fixes -m 11100 is_valid_hex_string()
This commit is contained in:
jsteube 2016-12-26 15:09:56 +01:00
parent ceed66d50b
commit 514fc0fe75
2 changed files with 506 additions and 389 deletions

View File

@ -123,18 +123,7 @@ void exec_hexify (const u8 *buf, const int len, u8 *out)
for (int i = max_len - 1, j = i * 2; i >= 0; i -= 1, j -= 2)
{
const u8 v = buf[i];
u8 h0 = v >> 4 & 15;
u8 h1 = v >> 0 & 15;
u8 add;
h0 += 6; add = ((h0 & 0x10) >> 4) * 39; h0 += 42 + add;
h1 += 6; add = ((h1 & 0x10) >> 4) * 39; h1 += 42 + add;
out[j + 0] = h0;
out[j + 1] = h1;
u8_to_hex_lower (buf[i], out + j);
}
out[max_len * 2] = 0;
@ -170,8 +159,8 @@ u8 hex_to_u8 (const u8 hex[2])
{
u8 v = 0;
v |= (hex_convert (hex[1]) << 0);
v |= (hex_convert (hex[0]) << 4);
v |= ((u8) hex_convert (hex[1]) << 0);
v |= ((u8) hex_convert (hex[0]) << 4);
return (v);
}
@ -180,14 +169,14 @@ u32 hex_to_u32 (const u8 hex[8])
{
u32 v = 0;
v |= ((u32) hex_convert (hex[7])) << 0;
v |= ((u32) hex_convert (hex[6])) << 4;
v |= ((u32) hex_convert (hex[5])) << 8;
v |= ((u32) hex_convert (hex[4])) << 12;
v |= ((u32) hex_convert (hex[3])) << 16;
v |= ((u32) hex_convert (hex[2])) << 20;
v |= ((u32) hex_convert (hex[1])) << 24;
v |= ((u32) hex_convert (hex[0])) << 28;
v |= ((u32) hex_convert (hex[1]) << 0);
v |= ((u32) hex_convert (hex[0]) << 4);
v |= ((u32) hex_convert (hex[3]) << 8);
v |= ((u32) hex_convert (hex[2]) << 12);
v |= ((u32) hex_convert (hex[5]) << 16);
v |= ((u32) hex_convert (hex[4]) << 20);
v |= ((u32) hex_convert (hex[7]) << 24);
v |= ((u32) hex_convert (hex[6]) << 28);
return (v);
}

File diff suppressed because it is too large Load Diff