How Binary and Hexadecimal Numbers Work

How Binary and Hexadecimal Numbers Work

By Writ10 | Informed Nonparticulars | 16 Aug 2021


In popular culture, computers are depicted communicating in binary with a bunch of bits lined up in a manner something like this:

000001010010001010101

 

And if you look at your keys for whatever cryptocurrency you own, you’ll see something like:

E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262

 

To most people, this looks like a bunch of computer gobbledygook from some sort of incomprehensible dead language. What it actually is, however, is a number. It’s just not in a format you might recognize.

 
Let's Deconstruct Numbers a Bit...

Normally, when you count upwards from zero (00), you increment in the one’s place until you reach nine (09). Then, to make ten, you reset the number in the one’s place to zero and then increase the number to the left by one. Thus, ending up with (10) and the process starts over. This is counting in Base ten. When you reach ten, you "carry over" to the next integer.

 

We don’t have to count in Base Ten. We could theoretically make anything our base for counting. In fact, we already do something like this when we measure time. After 60 seconds, we increment minutes by one, and after sixty minutes we increment hours by one. The same sort of thing goes for all that gobbledygook we see in computers and our keys. They're just numbers with a different base.

 

Binary is just Base Two. Computers use it because they're fundamentally just a bunch of transistors, and transistors have 2 states, ON (1), or OFF (0). In Base Two, you carry over every time you reach two, so one would be "1", two would be "10," three would be "100," and so on.

 

Our keys on the other hand, are Hexadecimal numbers, which are in Base Sixteen. There are basically three reasons why our computers use Hexadecimal (as opposed to anything else) that are explained in excellent detail in this other article but the reasons basically are:

  1. It compresses data as one hex digit can represent 0 to 15.
  2. It's relatively easy to read.
  3. It can easily convert into bytes (which are 8 bits long). Two hex digits = 1 byte.

The way Hexadecimal works is we assign digits eleven through fifteen the letters A – F and then increment the next integer when we reach 16. So, compared to Base 10 it looks like this:

You could (almost) summarize the entire article with just this picture (lol)

 

You can convert a Hexadecimal number by hand by multiplying each integer by its distance from the least significant digit, then adding them together [For Example: 1B = 1*16^1 + 11*16^0 = 16 + 11 = 27] but it's much easier to just use an online converting tool. I would NEVER recommend placing your private key into this online tool, or any site whatsoever. But for the sake of curiosity, when we place our fake key from the beginning of the article, we get...

105627842363267744400190144423808258002852957479547731009248450467191077417570

which is about 105 quattuorvigintillion. There are many analogies and terms you might use to describe this, but I'll leave it to the AvE dictionary for this one.

How do you rate this article?

3



Informed Nonparticulars
Informed Nonparticulars

An attempt at informed writings on a litany of topics including, but not limited to: things, stuff, and crypto.

Publish0x

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.