View Single Post
  #4  
Old 08-19-2019, 07:46
chants chants is offline
Family
 
Join Date: Jul 2016
Posts: 456
Rept. Given: 2
Rept. Rcvd 30 Times in 18 Posts
Thanks Given: 373
Thanks Rcvd at 723 Times in 331 Posts
chants Reputation: 30
First off the relevant file for this change (assuming you are using the 1450 variant which it sure sounds like you are) - size independent files:
Quote:
https://github.com/hashcat/hashcat/blob/master/OpenCL/inc_hash_sha256.h
https://github.com/hashcat/hashcat/blob/master/OpenCL/inc_hash_sha256.cl
https://github.com/hashcat/hashcat/blob/master/OpenCL/m01450_a0-pure.cl
https://github.com/hashcat/hashcat/blob/master/OpenCL/inc_rp.cl
This chain led me to:
Quote:
https://github.com/hashcat/hashcat/blob/master/OpenCL/inc_types.h
Code:
typedef struct pw
{
  u32 i[64];
  u32 pw_len;
} pw_t;
So sizeof(u32)*64 = 256...change to sizeof(u32)*2048=8192. I am assuming you made exactly this change and recompiled e.g. u32 i[2048];

I don't know why it would crash - perhaps you can use a debugger and give the source code line upon which it crashes. I am assuming you are using OpenCL and not GPU though I would have imagined they would share definitional source.

It does call sha256_hmac_init_swap which has special handling above 64 size - the truncation to 8 bytes looks strange and maybe this is untested given the buffer limitation? It in turn calls sha256_update_swap which looks like it handles any size. Based on the spec:
Quote:
https://en.wikipedia.org/wiki/HMAC
it would seem this is correct behavior as 256 bit output is 32 bytes.

It would be nice to make a PR for this but because of the optimization sensitive nature of this project, more thinking about exactly how to do that is needed - maintain optimization while allowing the buffer size to change without annoying recompilations.

Oh and finally this is likely the issue - code needs to be generalized in:
Quote:
https://github.com/hashcat/hashcat/blob/master/src/modules/module_01450.c
First change:
Code:
  token.len_min[1] = SALT_MIN;
  token.len_max[1] = SALT_MAX;
Next change:
Code:
  digest[0] = hex_to_u32 (hash_pos +  0);
  digest[1] = hex_to_u32 (hash_pos +  8);
  digest[2] = hex_to_u32 (hash_pos + 16);
  digest[3] = hex_to_u32 (hash_pos + 24);
  digest[4] = hex_to_u32 (hash_pos + 32);
  digest[5] = hex_to_u32 (hash_pos + 40);
  digest[6] = hex_to_u32 (hash_pos + 48);
  digest[7] = hex_to_u32 (hash_pos + 56);
  digest[0] = byte_swap_32 (digest[0]);
  digest[1] = byte_swap_32 (digest[1]);
  digest[2] = byte_swap_32 (digest[2]);
  digest[3] = byte_swap_32 (digest[3]);
  digest[4] = byte_swap_32 (digest[4]);
  digest[5] = byte_swap_32 (digest[5]);
  digest[6] = byte_swap_32 (digest[6]);
  digest[7] = byte_swap_32 (digest[7]);

Last edited by chants; 08-19-2019 at 08:13.
Reply With Quote