replace num_to_hex_string() with sprintf()

When output width is not an issue.