Help! print hash result in hex in kernel
#1
Hello, recently I changed one kernel file with my hash algorithm.
It is some iterations of HMAC-SHA-512. So I worked on the kernel of it.

When, I changed three pure files and start to test the new kernel. 
I got the error of self-test failed. (Before I started, I deleted all files under /kernels and changed the ST_PASS and ST_HASH values in module_1760.c to right.)

So I want to know the hash result in every iteration but don't know how to print it to standard output.

any help will be appreciated. Thanks.
Reply
#2
you can use normal printf debugging:
Code:
printf ("08x\n", a);

also have a look at the dev guide, it will explain several of these concepts and how to best develop/debug: https://github.com/hashcat/hashcat/blob/...t-guide.md

while developing you could temporarily disable the self-test with --self-test-disable, it also makes sense to limit the amount of password candidates per second, and also the input (1 word in dict)... e.g. -n 1 -u 1 -T 1 --force (attention: only developers that have a working system and do know what they are doing can/should sometimes use --force, NEVER EVER use this otherwise)
thx.
Reply
#3
Hello,after I add a line "printf("%08x\n", ctx.opad.h);" in kernel function, I got an error "Kernel minimum runtime larger than default TDR".
And I also tested in the kernel of HMAC-SHA512, it can crack hash without printf and can't crack the same example with printf, getting the same error.
The parameters are added, e.g. --self-test-disable -n 1 -u 1 -T 1 --force.
Reply
#4
Calling printf slows down the kernel a *lot*; if you're doing it in the inner-most loop, it's probably being called often enough to put the kernel out the back in terms of runtime. However, `-n1 -u1` is *supposed* to cause `autotune` to return before it gets to the TDR measurement (autotune.c:121 & 147). Any chance you're not doing what you think you're doing?
Reply