Refactored hexdump() to use putchar.