The Magic of Binary
In my endeavors as a software developer I gain deeper understanding of Computer Science each year. One thing that has always intrigued me has been binary numbering. As far as I know, everything wonderful and awesome we can do on our computers eventually boils down to a machine interpreting ones and zeroes. For example, the very keyboard on which I type has circuitry that associates each key or combination of keys with a certain numerical code. The computer receives this number and, because of the context in which it was received, knows to interpret this number as a certain letter. The letter ‘A’, for example, has decimal value of 65. It’s hexadecimal representation would be 0×41 and it’s binary representation 01000001. Not to deviate too much from my theme, but even the numbering for the ASCII codes has been extremely well thought out. For upper-case letters, there is always a 010 prefix and for lower-case the prefix is always 011. After the prefix, we are left with 5 bits to represent the letter. We can calculate the number of possible arrangements for a number of bits using 2^n where n is the number of bits. This leaves 32 possible arrangements for 5 bits, which is more than the number of letters in our alphabet. To translate from an ASCII letter to its numerical counterpart and vice versa then becomes easy. Let’s take the letter ‘P’ for example. ‘P’ is the 16th letter of our alphabet. It is a capital letter so it’s prefix would be 010. The number sixteen in binary is 10000. We add that to our prefix and get 01010000, which has a decimal value of 80. Therefore, the key code for the letter ‘P’ is 80. I digress. This is just one of the many amazing ways binary is used in Computer Science. As I said, it’s amazing to me that everything eventually boils down to these ones and zeroes and even electrical high and low signals. Another example would be the screen drawn in front of you. Each pixel (picture element) on your screen has a value associated with it stored in video memory that the video card interprets as a color. The video card knows what signals to send to the monitor to draw this color. The resolution on my screen right now is 1440×900. This means that the screen draws 1440 pixels wide and 900 pixels high. That’s 1,296,000 values floating around in my video memory. Of course, you may have double or triple buffering and this number would be 2 or 3 times as high and as I’m driving three monitors with my new Radeon HD 7770 I’d have to add that multiplication. Again, I digress. The real magic of binary for me is the simple fact that everything we do on our computers is just an interpretation of these high/low, 1/0 values. It all comes down to context and interpretation. I might have a hex value of c0a80032 which in decimal is 3232235570. You might never know what this number means unless you know the context from which it came. If I told you however, that this number was my local IP address right now, you might sooner work it out by breaking it down in octets. 0xc0 = 192, 0xa8 = 168, 0×00 = 0, 0×32 = 50. 192.168.0.50. Also, anyone who’s done a bit of network coding might pick out 0xc0a8 as 192.168.
Binary is magical to me because it represents possibilities. It is the basis on which our layers of abstraction in the computing world are built and there are so many layers of abstraction that after years of studying I feel I’ve only scratched the surface!
46:6f:72:20:42:72:69:65


