diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/util/bits.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/bits.c b/src/util/bits.c index 6adae05..ab8180b 100644 --- a/src/util/bits.c +++ b/src/util/bits.c @@ -111,7 +111,7 @@ char *bits_to_hex(const bits_t *bits) { char *result = try_calloc(BYTE_LEN(bits->bitlen) * 2 + 1); // probably right pad with zeroes, as thats what is actually stored. for (size_t i = 0; i < BYTE_LEN(bits->bitlen); ++i) { - sprintf(result + (i * 2), "%x", bits->bits[i]); + sprintf(result + (i * 2), "%02x", bits->bits[i]); } return result; } @@ -119,7 +119,7 @@ char *bits_to_hex(const bits_t *bits) { char *bits_to_bin(const bits_t *bits) { char *result = try_calloc(bits->bitlen + 1); for (size_t i = 0; i < bits->bitlen; ++i) { - sprintf(result + i, "%u", GET_BIT(bits->bits, i)); + sprintf(result + i, "%1u", GET_BIT(bits->bits, i)); } return result; } |
