I'd like to add a new algotithm to hashcat (3). It seems to me that e.g. https://github.com/hashcat/oclHashcat/co...2ac427179c
is a good starting point. I've got some questions though:
In the diffs I see that four kernels are added: OpenCL/m*_a[0-3].cl. Why 4? What's the use of a0/a1/a2/a3? To simplify testing, can I also use just one?
Can somebody provide me with tips 'n tricks for debugging OpenCL kernels? I'm looking for ways to check values of variables etc., thing like a printf that runs / triggers from the kernel and displays data to console out.
For getting to know hashcat, I'd like to clone and slightly change existing algorithms.
Step 1 consisted of copying an existing algorithm to a new hash number to make sure that I understand hashcat's structure. This works fine. I've cloned SHA1 (m=100) for this test. Success!
Step 2 is extending the copied algorithm to something new to understand the OpenCL kernels. Let's say I want to update the copied SHA1(candidate_password) to SHA1(SHA1(candidate_password)). The main action seems to be in the function m00100m, originally implementing:
- candidate_hash = SHA1(candidate_password)
- compare(canidate_hash, real_hash)
To get going I want to understand and implement:
- temp = SHA1(candidate_password)
- candidate_hash = SHA1(temp)
- compare(canidate_hash, real_hash)
Due to the highly optimized code, it's difficult for me to understand it, especially since I don't understand the varaible names convention (if any) and the very limited documentation in the code.
I know that m=4500 is a double SHA1 but the second SHA1 is calculated over the hexstring value of the canidate password, not over the raw SHA1 byte output of the first iteration (example: SHA1(ASCII '123') = 0x40bd001563085fc35165329ea1ff5c5ecbdbbeef, SHA1(ASCII '40bd001563085fc35165329ea1ff5c5ecbdbbeef') = 0x9adcb29710e807607b683f62e555c22dc5659713), this can be cracked with m=4500 where I want to crack SHA1(0x40bd001563085fc35165329ea1ff5c5ecbdbbeef) = 0x23ae809ddacaf96af0fd78ed04b6a265e05aa257) .
My question: can someone please (explicitly) guide me throught step 2 by for example:
- using m=100 twice (raw byte values as input for the second SHA1)
- using m=4500 with stripping the raw bytes to hexstring conversion starting on line 191 in OpenCL/m04500_a3.cl.
This will for sure help me understanding the kernels and will keep me on track for implementing new stuff.
Thank you for your help.
John
is a good starting point. I've got some questions though:
In the diffs I see that four kernels are added: OpenCL/m*_a[0-3].cl. Why 4? What's the use of a0/a1/a2/a3? To simplify testing, can I also use just one?
Can somebody provide me with tips 'n tricks for debugging OpenCL kernels? I'm looking for ways to check values of variables etc., thing like a printf that runs / triggers from the kernel and displays data to console out.
For getting to know hashcat, I'd like to clone and slightly change existing algorithms.
Step 1 consisted of copying an existing algorithm to a new hash number to make sure that I understand hashcat's structure. This works fine. I've cloned SHA1 (m=100) for this test. Success!
Step 2 is extending the copied algorithm to something new to understand the OpenCL kernels. Let's say I want to update the copied SHA1(candidate_password) to SHA1(SHA1(candidate_password)). The main action seems to be in the function m00100m, originally implementing:
- candidate_hash = SHA1(candidate_password)
- compare(canidate_hash, real_hash)
To get going I want to understand and implement:
- temp = SHA1(candidate_password)
- candidate_hash = SHA1(temp)
- compare(canidate_hash, real_hash)
Due to the highly optimized code, it's difficult for me to understand it, especially since I don't understand the varaible names convention (if any) and the very limited documentation in the code.
I know that m=4500 is a double SHA1 but the second SHA1 is calculated over the hexstring value of the canidate password, not over the raw SHA1 byte output of the first iteration (example: SHA1(ASCII '123') = 0x40bd001563085fc35165329ea1ff5c5ecbdbbeef, SHA1(ASCII '40bd001563085fc35165329ea1ff5c5ecbdbbeef') = 0x9adcb29710e807607b683f62e555c22dc5659713), this can be cracked with m=4500 where I want to crack SHA1(0x40bd001563085fc35165329ea1ff5c5ecbdbbeef) = 0x23ae809ddacaf96af0fd78ed04b6a265e05aa257) .
My question: can someone please (explicitly) guide me throught step 2 by for example:
- using m=100 twice (raw byte values as input for the second SHA1)
- using m=4500 with stripping the raw bytes to hexstring conversion starting on line 191 in OpenCL/m04500_a3.cl.
This will for sure help me understanding the kernels and will keep me on track for implementing new stuff.
Thank you for your help.
John