![]() |
Precomputing salt / debugging module files - Printable Version +- hashcat Forum (https://hashcat.net/forum) +-- Forum: Developer (https://hashcat.net/forum/forum-39.html) +--- Forum: hashcat (https://hashcat.net/forum/forum-40.html) +--- Thread: Precomputing salt / debugging module files (/thread-9406.html) |
Precomputing salt / debugging module files - AndrewOnDev - 07-22-2020 Hello, I'd like to create mode simillar to already existing one: 3910 - md5(md5($pass).md5($salt)) although I'd like to replace md5($salt) with sha1($salt) I decided to precompute salt in module file as it's done in 3910 but I can't really make it work. I also noticed that mode 21200 - md5(sha1($salt).md5($pass)) doesn't precompute salt in the module file. That makes me wonder is there something missing in hashcat source that makes it impossible to implement it? I've made few attempts to write the precompute function for sha1 salt by myself but apparently I failed, because by using printfs in the kernel it seems that sha1 hash is indeed passed to the salt buffer, but it's most certainly not the sha1 hash of the test salt I use. So I wonder maybe I should receive any tips or at least help with debugging module file, because I have no clue how to do this. This is the code I modified from 3910 module. I assumed I have to swap the salt. Code: static void precompute_salt_sha1 (const u32 *salt_buf, const u32 salt_len, u8 *salt_pc) RE: Precomputing salt / debugging module files - philsmd - 07-29-2020 Thank you very much for the hint about -m 21200 (which wasn't optimized to compute sha1($salt) within the host code once and only once per hash). I've suggested the change here and it was merged: https://github.com/hashcat/hashcat/pull/2501 To answer your question: my guess is that the only problem here is that the input buffer is not large enough: The data variable (the data input, "message"/salt/password/data etc you want to hash) must be of at least a certain size, see: https://github.com/hashcat/hashcat/blob/cec6051d742e297cd546e19555fba68d04d70a48/OpenCL/inc_hash_sha1.cl#L15 so you should use Code: u32 saltSwapped[16] = { 0 }; btw: I'm not saying that it must be swapped, that is something that needs to be checked for your specific situation, althrough it doesn't seem completely unlikely that some swaps need to be added (or removed).... all I'm saying is that to achieve a "64 byte alignment" you need to use something like: Code: u32 data[16] = { 0 }; because 16*4 bytes = 64 byte. I hope this will at least solve one of the problems. Thanks again RE: Precomputing salt / debugging module files - AndrewOnDev - 07-30-2020 I actually noticed it's been merged on github so everything is clear for me now. Thank you very much for the tip about input buffer size. I guess thread can be closed now. Cheers! |