Skip to content

Commit 936eaa5

Browse files
authored
Merge pull request #271 from hugueskamba/hk-make-minimal-printf-compatible
Make compatible with Minimal-printf
2 parents 373a411 + 4e226c7 commit 936eaa5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hashing/main.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ static void print_hex(const char *title, const unsigned char buf[], size_t len)
3737
{
3838
mbedtls_printf("%s: ", title);
3939

40-
for (size_t i = 0; i < len; i++)
41-
mbedtls_printf("%02x", buf[i]);
40+
for (size_t i = 0; i < len; i++) {
41+
if (buf[i] < 0xF) {
42+
mbedtls_printf("0%x", buf[i]);
43+
} else {
44+
mbedtls_printf("%x", buf[i]);
45+
}
46+
}
4247

4348
mbedtls_printf("\n");
4449
}

0 commit comments

Comments
 (0)