From 91d2cbead7ec0a4eac63985335fe5df089323fb0 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 26 Aug 2020 22:33:43 +0200 Subject: [PATCH 1/3] add --force to the CLI example in the dev guide --- docs/hashcat-plugin-development-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/hashcat-plugin-development-guide.md b/docs/hashcat-plugin-development-guide.md index 078aa64d0..6abd74992 100644 --- a/docs/hashcat-plugin-development-guide.md +++ b/docs/hashcat-plugin-development-guide.md @@ -539,7 +539,7 @@ Additionally there is a couple of command line parameters that you want to use: 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 +$ 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. From 0c4c4d042e3a049cf8fa900b097ff05df6c3636a Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 26 Aug 2020 22:35:00 +0200 Subject: [PATCH 2/3] added example of how not to do printf --- docs/hashcat-plugin-development-guide.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/hashcat-plugin-development-guide.md b/docs/hashcat-plugin-development-guide.md index 6abd74992..2e85fa214 100644 --- a/docs/hashcat-plugin-development-guide.md +++ b/docs/hashcat-plugin-development-guide.md @@ -537,17 +537,21 @@ 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. 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 ``` 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. - ``` if ((loop_pos + i) == 0) printf ("%08x\n", a); ``` +When using -n 1 -u 1 -T 1 you shouldn't add +``` +if((gid==1) && (lid==1)) { +``` +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. + 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. To decide which type of kernel you want to write (pure or optimized), here are some recommendations when to write an optimized kernel implementation: From 8eed6b95a5ffe04551be924685c9d728235af641 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 10 Sep 2020 21:51:24 +0200 Subject: [PATCH 3/3] added an example of a printf() from a non _loop kernel, and rewrote the explanation for the need of a contional when using printf() --- docs/hashcat-plugin-development-guide.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/hashcat-plugin-development-guide.md b/docs/hashcat-plugin-development-guide.md index 2e85fa214..77bd92e33 100644 --- a/docs/hashcat-plugin-development-guide.md +++ b/docs/hashcat-plugin-development-guide.md @@ -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. 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 ``` -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); ``` -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.