diff --git a/src/NT_fmt_plug.c b/src/NT_fmt_plug.c index 411d6c3..eb52e3d 100644 --- a/src/NT_fmt_plug.c +++ b/src/NT_fmt_plug.c @@ -411,6 +411,16 @@ static int binary_hash_4(void *binary) return ((unsigned int *)binary)[1] & 0x0FFFFF; } +static int binary_hash_5(void *binary) +{ + return ((unsigned int *)binary)[1] & 0x0FFFFFF; +} + +static int binary_hash_6(void *binary) +{ + return ((unsigned int *)binary)[1] & 0x07FFFFFF; +} + static int get_hash_0(int index) { #if defined(NT_X86_64) @@ -481,6 +491,34 @@ static int get_hash_4(int index) #endif } +static int get_hash_5(int index) +{ +#if defined(NT_X86_64) + return output8x[32*(index>>3)+8+index%8] & 0x0FFFFFF; +#elif defined(NT_SSE2) + if(index>2)+4+index%4] & 0x0FFFFFF; + else + return output1x[(index-NT_NUM_KEYS4)*4+1] & 0x0FFFFFF; +#else + return output1x[(index<<2)+1] & 0x0FFFFFF; +#endif +} + +static int get_hash_6(int index) +{ +#if defined(NT_X86_64) + return output8x[32*(index>>3)+8+index%8] & 0x07FFFFFF; +#elif defined(NT_SSE2) + if(index>2)+4+index%4] & 0x07FFFFFF; + else + return output1x[(index-NT_NUM_KEYS4)*4+1] & 0x07FFFFFF; +#else + return output1x[(index<<2)+1] & 0x07FFFFFF; +#endif +} + static int cmp_all(void *binary, int count) { unsigned int i=0; @@ -611,7 +649,7 @@ static inline void set_key_helper(unsigned int * keybuffer, { unsigned int i=0; unsigned int md4_size=0; - for(; key[md4_size] && md4_size < PLAINTEXT_LENGTH; i += xBuf, md4_size++) + for(; key[md4_size]; i += xBuf, md4_size++) { unsigned int temp; if ((temp = key[++md4_size])) @@ -703,7 +741,7 @@ static inline void set_key_helper_utf8(unsigned int * keybuffer, unsigned int xB } source++; outlen++; - if (*source) { + if (*source && (target < targetEnd)) { chh = *source; if (chh >= 0xC0) { unsigned int extraBytesToRead = @@ -739,15 +777,12 @@ static inline void set_key_helper_utf8(unsigned int * keybuffer, unsigned int xB outlen++; } else { chh = 0x80; + *target = chh << 16 | chl; + target += xBuf; + break; } *target = chh << 16 | chl; target += xBuf; - if (*source == 0) { - break; - } - if (target >= targetEnd) { - break; - } } if (chh != 0x80 || outlen == 0) { *target = 0x80; @@ -807,7 +842,7 @@ static inline void set_key_helper_encoding(unsigned int * keybuffer, } else { unsigned int temp; i = 0; - for(md4_size = 0; key[md4_size] && md4_size < PLAINTEXT_LENGTH; i += xBuf, md4_size++) + for(md4_size = 0; key[md4_size]; i += xBuf, md4_size++) { if ((temp = CP_to_Unicode[key[++md4_size]])) keybuffer[i] = CP_to_Unicode[key[md4_size-1]] | (temp << 16); @@ -921,7 +956,9 @@ struct fmt_main fmt_NT = { binary_hash_1, binary_hash_2, binary_hash_3, - binary_hash_4 + binary_hash_4, + binary_hash_5, + binary_hash_6 }, fmt_default_salt_hash, fmt_default_set_salt, @@ -934,7 +971,9 @@ struct fmt_main fmt_NT = { get_hash_1, get_hash_2, get_hash_3, - get_hash_4 + get_hash_4, + get_hash_5, + get_hash_6 }, cmp_all, cmp_one,