What is pw_len of the pw type ?
#1
Question 
Hi all,

When looking at the source code of Hashcat I noticed that the candidate passwords are stored in a type called pw (defined line 1643 of OpenCL/inc_types.h).
This type is simple, the code is this
Code:
typedef struct pw
{
    u32 i[64];
    u32 pw_len;
} pw_t;
However, each character of the candidate password is only 1 byte right ? I read somewhere on an old thread that pw.i[0] would hold the first 4 characters of the candidate password, etc ... In that case, what is pw_len ? is it the length of the array of the length in chars ?
Suppose my password is "hashcat" (7 chars long), we sould have something like
pw.i[0] = hash
pw.i[1] = cat0 (I'm guessing that all "unused" bytes are null bytes)
pw.i[2] = 0 ...
in that case is pw_len 2 or 7 ?

I'm trying to implement FNV1 as an exercise and for this algorithm I need to iterate over every byte of data. If pw_len is the length of the pw.i array, is there another way to get the length in bytes of the candidate password ?

Thanks a lot in advance
Reply
#2
yes u32[] means that each item consist of 4 bytes, i.e. 64 * 4 = 256 maximum password length

pw_len is the length in bytes, of course (everything else wouldn't make sense). each additional character/byte in i[] would imply that pw_len increases with 1
Reply
#3
(02-26-2020, 01:14 PM)philsmd Wrote: yes u32[] means that each item consist of 4 bytes, i.e. 64 * 4 = 256 maximum password length

pw_len is the length in bytes, of course (everything else wouldn't make sense). each additional character/byte in i[] would imply that pw_len increases with 1
Great, thank you for your quick response
Reply