More hex conversion cleanup

Found a few more places that can easily be switched to use `sprint_hex_inrow`
This commit is contained in:
Aaron Tulino (Aaronjamt) committed 2025-12-20 13:49:05 -07:00
1 parent d4034d4ea1
commit d7c9094cad
3 files changed
+20 -50

No files matched your search

+2 -7
View File
@@ -80,20 +80,15 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) {
PrintAndLogEx(FAILED, "Error in step %" PRId64 ", Return code: %" PRId64, resp.oldarg[0], resp.oldarg[1]);
} else {
size_t nonce_length = resp.oldarg[1];
size_t nonce_length_bytes = 2 * nonce_length + 1;
char *nonce = (char *) calloc(2 * nonce_length + 1, sizeof(uint8_t));
if (nonce == NULL) {
PrintAndLogEx(WARNING, "Failed to allocate memory");
return PM3_EMALLOC;
}
for (int j = 0; j < nonce_length; j++) {
int nonce_offset = 2 * j;
snprintf(nonce + nonce_offset, (nonce_length_bytes * sizeof(uint8_t)) - nonce_offset, "%02X", resp.data.asBytes[j]);
}
// print nonce
PrintAndLogEx(SUCCESS, "Length: %zu, Nonce: %s", nonce_length, nonce);
PrintAndLogEx(SUCCESS, "Length: %zu, Nonce: %s", nonce_length, sprint_hex_inrow(resp.data.asBytes, nonce_length));
free(nonce);
}
if (i < n - 1) {