Closed micolous closed 7 years ago
Merry X-mas! Thanks for your ideas and commits.
If I understand your reason for this PR its to be working more with your pm3-client-as-a-lib project. You can use the mfkey source under /tools/mfkey to make a stand-alone version instead. I suggest you remove the printf/printandlog at all in a stand-alone version for your build. They don't help you and is a reason I've started to have them printed only when 'verbose mode' is asked for. If you just want the key, you don't need execution time, setup data etc etc.
The main reason for more and more prinft statements in my fork is not to clutter the log file with more or less debugstatements. They are not needed for 99% of the users.
I'm not inclined to merge this PR at the moment if you can't convince me otherwise.
I'm trying to keep my client in sync with the C client for cryptographic functions, which is why I chose this approach. I think non-printf
logging is a common issue between both my project and the pm3gui (which IIRC is not currently serviceable, but someone may pick that up in future).
Going and pulling this all into a library is another option, but mfkey32v2
is not the only cryptographic function that I want to reference going forward. I want to avoid a situation where I need to copy large parts of the crypto code.
I am not worried as much about hardware interface and UI code -- this is generally much simpler and harder to mess up.
I understand that exporting a consistent interface from pm3 is difficult, when it is traditionally the only user of that code.
I'd like both the C client and the Android client to be able to share cryptographic code between them. So an alternative way is to move that code into a shared library which both can reference. This would also allow other implementations of the PM3 client in future.
Use
PrintAndLog
instead ofprintf
, so that the logger/UI can pull debugging information, instead of it being sent tostdout
.I've unrolled a loop here so I don't have to mess around with allocating a buffer for each row of the
nonce2key
table, as everyPrintAndLog
call includes a newline character.There's a lot of other
printf
calls in the client which should be addressed at some point.