1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Make base64_encode_three_bytes_better() in -m 32500 more readable

This commit is contained in:
jsteube 2023-09-07 15:00:30 +00:00
parent 5b06ffe63f
commit d4c9c4fae4

View File

@ -97,12 +97,12 @@ CONSTANT_VK u32 base64_table[64] =
DECLSPEC u32 base64_encode_three_bytes_better (u32 in) DECLSPEC u32 base64_encode_three_bytes_better (u32 in)
{ {
//in has 3 u8s in, first u8 is not set) //in has 3 u8s in, first u8 is not set)
u32 out; u32 out = 0;
out = base64_table[(in >> 18) & 0x3F] << 24; out |= base64_table[(in >> 18) & 0x3F] << 24;
out |= base64_table[(in >> 12) & 0x3F] << 16; out |= base64_table[(in >> 12) & 0x3F] << 16;
out |= base64_table[(in >> 6) & 0x3F] << 8; out |= base64_table[(in >> 6) & 0x3F] << 8;
out |= base64_table[(in ) & 0x3F]; out |= base64_table[(in >> 0) & 0x3F] << 0;
return out; return out;
} }
@ -112,12 +112,12 @@ DECLSPEC void base64_encode_sha256 (u32 *out, const u32 *in)
out[0] = base64_encode_three_bytes_better( (in[0] >> 8)); out[0] = base64_encode_three_bytes_better( (in[0] >> 8));
out[1] = base64_encode_three_bytes_better((in[0] << 16) | (in[1] >> 16)); out[1] = base64_encode_three_bytes_better((in[0] << 16) | (in[1] >> 16));
out[2] = base64_encode_three_bytes_better((in[1] << 8) | (in[2] >> 24)); out[2] = base64_encode_three_bytes_better((in[1] << 8) | (in[2] >> 24));
out[3] = base64_encode_three_bytes_better((in[2] )); out[3] = base64_encode_three_bytes_better((in[2] << 0));
out[4] = base64_encode_three_bytes_better( (in[3] >> 8)); out[4] = base64_encode_three_bytes_better( (in[3] >> 8));
out[5] = base64_encode_three_bytes_better((in[3] << 16) | (in[4] >> 16)); out[5] = base64_encode_three_bytes_better((in[3] << 16) | (in[4] >> 16));
out[6] = base64_encode_three_bytes_better((in[4] << 8) | (in[5] >> 24)); out[6] = base64_encode_three_bytes_better((in[4] << 8) | (in[5] >> 24));
out[7] = base64_encode_three_bytes_better((in[5] )); out[7] = base64_encode_three_bytes_better((in[5] << 0));
out[8] = base64_encode_three_bytes_better( (in[6] >> 8)); out[8] = base64_encode_three_bytes_better( (in[6] >> 8));
out[9] = base64_encode_three_bytes_better((in[6] << 16) | (in[7] >> 16)); out[9] = base64_encode_three_bytes_better((in[6] << 16) | (in[7] >> 16));