Advertisements

Hexadecimal to Bit Display Utility

This is a very simple command-line utility to display 32bit hexadecimal numbers to a friendly bit-to-bit visualization, with a nice indication of bit offsets.

I found this really useful when decoding dumps of 32 bit registers against the register descriptions found in datasheets at 2 AM in the morning after a day spent watching boot logs on a terminal… this things can happen!

This is an example of the application call and output:

$ ./hex2bit deadbeef cafecafe 12345678
       bin:  3           2              1           0
            1098 7654 3210 9876 - 5432 1098 7654 3210

0xdeadbeef: 1101 1110 1010 1101 - 1011 1110 1110 1111 
0xcafecafe: 1100 1010 1111 1110 - 1100 1010 1111 1110 
0x12345678: 0001 0010 0011 0100 - 0101 0110 0111 1000

Read more of this post

Advertisements