Custom OpenCL kernel question - 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: Custom OpenCL kernel question (/thread-7600.html) |
Custom OpenCL kernel question - hashdawg - 06-21-2018 Hi. I'm trying to write a custom kernel to implement algorythm like this: PHP Code: $static_salt1 = "123jjdsfhjrhfjrhdkedjkewdjdwjdwkjdkewjdkewjdkewjkdjwefjrhfjrhfjrhfjrhfjhrjfhrjsbdnsbdfrfjeh4jh43jhj34hjd3hdjbnbedbwedkjewbdkjedwkejdefre\n\rs"; $static_salt1 is more than 64 symbols and contains special symbols like "\r\n", $static_salt2 is more than 64 symbols as well, both are fixed for every hash. Obviously, because of the big fixed salts I can't use optimized kernel feature, so I'm trying to figure out how to write pure OpenCL kernel. I'm a total noob in C / hashcat, but previously I've implemented similar algorythm in hashcat-legacy and it works there, but new hashcat has completely different architecture. In hashcat-legacy it was easier because there were multiple examples of hash algorithms using fixed salts, but I can't find any proper examples in new hashcat code base. Where/How should I pass both these static salts? Do I do this directly in OpenCL kernel? Should I put both salts definition in include/interface.h ? Maybe you can point me into some example algorithm which passes multiple static salts as an example. Sorry, for stupid questions just trying to figure it out. Thanks. RE: Custom OpenCL kernel question - atom - 06-22-2018 If both salts are fixed you can hardcode them into the kernel code, saves you some work. See kernel 2610 to get any idea on how to start. RE: Custom OpenCL kernel question - hashdawg - 06-22-2018 (06-22-2018, 09:52 AM)atom Wrote: If both salts are fixed you can hardcode them into the kernel code, saves you some work. See kernel 2610 to get any idea on how to start. Interestingly, I can't find any mentions on 2610 algorithm in src/interface.c Thanks for the tip, looking into it! EDIT: ok, I think I got it - it's just a general type kernel which is used in multiple algorithms. RE: Custom OpenCL kernel question - hashdawg - 06-23-2018 Finally, after a day of struggling I was able to implement what I've needed! It's very tricky to pass multiple salts to a kernel, I had to use concatenated salt in parsing function (src/interface.c) and then pad every single salt with 0 bytes at the end so it aligns properly to 4 bytes when read in the kernel. Not an easy task to understand everything that is going on in the hashcat. That was fun though implementing the algorithm! The speed I have with pure unoptimized kernel is: Code: Session..........: hashcat Still better speed than what I was getting with hashcat-legacy! RE: Custom OpenCL kernel question - hashdawg - 06-23-2018 It seems though I'm not getting full utilization on my GPUs for some reason? Is it because of the pure kernel? NOTE: I'm using big wordlist with huge rules, so there is no warning regarding "provide more work, etc". |