Hex

Hex is a data encoding format that is often used in Bitcoin and Bitcoin applications. When working with this tech, you will often find data displayed in hex format. If you're not already familiar with hex, now is the time, since you'll certainly run into it while working with Bitcoin.

We are quite used to the base 10 decimal system, it's great for counting on your fingers, as most of us have ten of them, but it's not always optimal for computer systems. The hexadecimal number system, or hex (https://en.wikipedia.org/wiki/Hexadecimal) is a number system made up of 16 symbols, it's base 16. It turns out that hex works better than decimal for displaying binary coded values to humans. Let's take a closer look at hex and why it works well with binary data.

Hexadecimal uses the decimal numbers, 0 through 9 and six additional symbols, the letters a through f. So that's 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, and f. In hexadecimal A = decimal 10, and F = decimal 15. While trying to think in hex is rather challenging for a human who is used to thinking in decimal, it is in theory rather simple. So why is it better than decimal for computer systems? Computers of course use binary, a base 2 system. Hex provides a human-friendly way to represent binary values. Each hexadecimal digit represents 4 bits, half a byte, which means that a single byte can have values ranging from 00000000 to 11111111 in binary, which can be much more compactly represented in hex as 00 to FF.

Working with Bitcoin you'll run across hex frequently. This is a basic introduction to hex, but much more info can be found in these two links:

 


Source: Saylor Academy
Creative Commons License This work is licensed under a Creative Commons Attribution 4.0 License.

Last modified: Tuesday, October 5, 2021, 4:16 PM