design hex to binary
memory allocated should be freed