1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 15:18:16 +00:00

added an example of a printf() from a non _loop kernel, and rewrote the explanation for the need of a contional when using printf()

This commit is contained in:
Your Name 2020-09-10 21:51:24 +02:00
parent 0c4c4d042e
commit 8eed6b95a5

View File

@ -537,20 +537,24 @@ Additionally there is a couple of command line parameters that you want to use:
* -d 1: In case you have multi compute devices in your system, limit it to a single compute device. This is to reduce startup and JiT compile time. * -d 1: In case you have multi compute devices in your system, limit it to a single compute device. This is to reduce startup and JiT compile time.
Typically a developer command line for hashcat looks the following: Typically a developer command line for hashcat looks the following:
``` ```
$ rm -rf kernels $HOME/.nv; ./hashcat -m XXXXX hash.txt word.txt --potfile-disable --self-test-disable -n 1 -u 1 -T 1 --quiet --backend-vector-width 1 -d 1 --force $ rm -rf kernels $HOME/.nv; ./hashcat -m XXXXX hash.txt word.txt --potfile-disable --self-test-disable -n 1 -u 1 -T 1 --quiet --backend-vector-width 1 -d 1 --force
``` ```
If you need to printf from without a _loop kernel, keep in mind that you need to add a branching manually for a specific loop position. When adding print statements keep in mind that you need to manually add a conditional to branch on a specific loop position, otherwise every parallel execution of the kernel will execute the printf(), flooding your terminal. So you can use either:
``` ```
if ((loop_pos + i) == 0) printf ("%08x\n", a); if ((loop_pos + i) == 0) printf ("%08x\n", a);
``` ```
When using -n 1 -u 1 -T 1 you shouldn't add from a _loop kernel, or
``` ```
if((gid==1) && (lid==1)) { if ((gid == 0) && (lid == 0)) printf ("%08x\n", a);
``` ```
to your kernel, as there will be only one kernel thread, there's no gid==1 (only gid==0) so your code won't be executed.
from a kernel without _loop.
Some last recommendations about printf() itself. Printing a string %s is not recommended. Missing zero bytes or big endian byte order can be very confusing. Instead try to use only the %08x template for everything. Especially for strings this makes a lot of sense, if for example you want to find unexpected non zero bytes. This can be done by calling printf() multiple times. Get used to this and it will simplify a lot of things for you. Some last recommendations about printf() itself. Printing a string %s is not recommended. Missing zero bytes or big endian byte order can be very confusing. Instead try to use only the %08x template for everything. Especially for strings this makes a lot of sense, if for example you want to find unexpected non zero bytes. This can be done by calling printf() multiple times. Get used to this and it will simplify a lot of things for you.