View Single Post
Old 11-26-2010, 04:00 AM   #6
Iconoclast
Senior Member
 
Join Date: Jul 2008
Posts: 278
Default

Of course ... sorry about the month delay in my response.

Before special interest in hacking I have always been very interested in developing my understanding of math, so I'm happy to clarify or discuss.

Quote:
~Hexadecimal to Binary
There are two ways. One requires memorization(blech) but is faster, and the other uses math but is slower.

1.
Let's convert F1.
F is equal to 15, which is 1111 in binary.
1 is, well, 0001, in binary.
Code:
*NOTE* It works best if each individual digit is in a group of four
when in binary. So if your digit is not in a group of four, just add 
0's at the front until it is.
Now, you simply just put the two together in order
11110001
There, that easy and quick.
This is the "memorization" method that you described.

Instead of storing these equivalences in our memory banks, it should be very easy to derive them to the point where we don't memorize them so much as know them.

It's very clear that you're acquainted enough with hexadecimal to quickly say what the decimal value of each digit is.

Instead of memorizing that the hex digit A is, in binary, 1010, we can mentally retrieve that knowledge by thinking:
0xA = 1(2^3) + 0(2^2) + 1(2^1) + 0(2^0) = 8 + 2 = 10.
0x7 = 0(2^3) + 1(2^2) + 1(2^1) + 1(2^0) = 7
et cetera

What I'm saying, is that this mental math is very easy to do efficiently. The speed of doing this for hex digits will be almost as fast as actually memorizing their binary forms, especially with practice, obviously.

I know it looks extensive at first, but with practice, it should occur naturally to you. Note that binary arithmetic is also known as base two arithmetic, so the base of all of those exponents you're multiplying by is the number two. The power of each exponent is the digit place of the binary format.
Iconoclast is offline   Reply With Quote