Binary to Hex

From Daelphinux
Jump to: navigation, search

Converting Binary to Hex can be done relatively simply in most programming languages, but can you write the conversion yourself?

Challenge

Write a Binary to Hex conversion program that can do the following without using any prebuilt conversion functions or libraries.

Requirements

  • Convert any number of binary digits to hex
  • Output a table of the binary converted next to the hex

Extras

  • Let the user choose to Output the table with each byte separated and converted
    • There are 8 bits in a byte
  • Let the user choose to Output the hex in a table of separated single byte values in 8x8 squares :
01 23 45 67 89 AB CD EF

Test Data

Feed it the following sets of digits and see the expected output:

Binary (Input) Hex (Output)
10001001 82
11001111 CF
10101010 AA
11111110 FE

Solution

This is an older challenge, and I do not presently have my solution for this.