Computers are digital and can therefore just distinguish between two conditions. Various synonyms are possible for the two conditions of a digital signal:
1 and 0
true and false
or for the hardware people low and high
To deal with bits, sequential bits are grouped together:
|
Number of bits |
Name |
Combinations |
Commonly used for |
|
4 |
nibble |
16 |
Hexadecimal character |
|
8 |
byte |
256 |
ASCII character |
|
16 |
word |
65536 |
Integer numbers |
Groups of 4 bits have 16 combinations the following characters are assigned:
| Bit 3 | Bit 2 | Bit 1 | Bit 0 | assigned character |
|
0 |
0 |
0 |
0 |
0 |
|
0 |
0 |
0 |
1 |
1 |
|
0 |
0 |
1 |
0 |
2 |
|
0 |
0 |
1 |
1 |
3 |
|
0 |
1 |
0 |
0 |
4 |
|
0 |
1 |
0 |
1 |
5 |
|
0 |
1 |
1 |
0 |
6 |
|
0 |
1 |
1 |
1 |
7 |
|
1 |
0 |
0 |
0 |
8 |
|
1 |
0 |
0 |
1 |
9 |
|
1 |
0 |
1 |
0 |
A |
|
1 |
0 |
1 |
1 |
B |
|
1 |
1 |
0 |
0 |
C |
|
1 |
1 |
0 |
1 |
D |
|
1 |
1 |
1 |
0 |
E |
|
1 |
1 |
1 |
1 |
F |
Just 16 combinations to convert a nibble to a bit sequence need to be remembered. A byte contains two nibbles and instead of representing it as a decimal number, it can be represented as two nibbles and therefore two hexadecimal numbers.
To observe a file hexdump -C <filename>
Install ghex to have a hex editor or a simple hex converter. To start type ghex2
Alternatives are: lfhex, hexer, hexedit, hexcurse, wxhexeditor.
Things that cause troubles:
carriage return (cr) line feed (lf) or carriage return (cr) only (=Unix style) at line ends
tabs or spaces used
utf-8 character encoding