Any transition serious enough to alter your definition of self will require not just small adjustments in your way of living and thinking but a full-on metamorphosis.
If you were to use a binary translator to figure out how to write the alphabet in binary, you would see a pattern. You can right now, if you want. Just search "binary translator" in Google. However, I'm going to give you the pattern right now:
CODE :
A - 01000001 E - 01000101
B - 01000010 F - 01000110
C - 01000011 G - 01000111
D - 01000100 H - 01001000
Do you see it? Well, if you already know how to count in binary, you would know that counting looks like this:
Now you should really see the pattern between the letters, particularly regarding the last three or four digits. It just follows the pattern of moving the 1 to the next place on the left, and then it adds a 1, which moves again to the left until it gets to the next 1, etc. This is a bit simplistic and literal, but you should get the point by now.
Anyway, what purpose does this serve for us? Well, to be honest, none yet, unless you want to write messages to your friends in binary when you get bored in class, which I have done a few times. Back to the point: you can also convert numbers from binary to the decimal system.
Here is the binary representation of a lowercase t:
CODE :
01110100
So what? Well, there's a way to convert a number from binary to decimal, as I mentioned before. But first, let's look at how the decimal system works.
Each number in the decimal system is made up of powers of ten. So the number 754 is the sum of (7 x 10^2) + (5 x 10^1) + (4 * 10^0) The ^2 and stuff is powers, so 10 squared, etc. This is because it's a base 10 system. Now you might be wondering what that means for the base 2 system. Well, each place is to the power of two, so 01110100 is the sum of
CODE :
0 x 2^7 OR 128
1 x 2^6 OR 64
1 x 2^5 OR 32
1 x 2^4 OR 16
0 x 2^3 OR 8
1 x 2^2 OR 4
0 x 2^1 OR 2
0 x 2^0 OR 1
Add together all of the values that it has 1 for, and you get 64 + 32 + 16 + 4, or 116. So that's how to convert binary into decimal.
You might be wondering about a few other languages you have heard of, called Hexadecimal and Octal. You can convert to them from binary too, and you can convert them back to binary. First I'll do Octal.
Octal is a base 8 system, so each digit is a power of 8. It's easy to convert octal to binary, because if you look at the binary counting that I did up there, they can all be expressed in 3 digits or less up until 7, and octal goes up to 7.
The problem is, how are you supposed to convert to octal if each octal digit needs 3 binary digits, and there are 8 in a byte? You count the digits of three from the right. So if you take a lowercase o, which is 01101111, then you count from the right.
On the rightmost part, you have three 1's, so that's a 7. Then you have a 101, which is a five. After that, you have a 01 left over. You can put as many zeroes to the left as you want, just like in the decimal system (065 is the same as 65), so 01 is the same as 001, which is a 1. The final octal representation of this is 157. It is also (1 x 8^2) + (5 * 8^1) + (7 * 8^0), or 111 in the decimal system. To convert back to binary, you take something like 143, and use 01 for the 1 part, 100 for the 4, and 011 for the three. Don't forget to add the leading zeroes if the binary digit is only 1 or 2 digits long.
Finally, there is Hexadecimal. You probably know that Hex is represented as two digits/numbers in pairs. Hex is base 16, so there aren't enough numerical characters. Therefore, they added 6 letters, a, b, c, d, e, and f, which represent 10, 11, 12, 13, 14, and 15, respectively. Hex looks like this: 68 61 63 6b 74 68 69 73 73 69 74 65. This is a less complicated because it cleaves a byte in half. However, you need four digits for each one. Here are the binary counting digits past what I went to before:
CODE :
9 - 1001
a - 1010
b - 1011
c - 1100
d - 1101
e - 1110
f - 1111
So if you have a byte that is 01101011, a lowercase k, then you split it into two parts: 0110 and 1011. With the first four bits, you can ignore the first 0 and count it as a 6. For the last four bits, you can use the list above to make it b. So the lowercase k in hex is 6b.
How do you convert numbers? It's the same principle as the other systems. Each one is a multiple of a power of 16, but keep in mind that a, b, c, d, e, and f stand for 10, 11, 12, 13, 14, and 15. So this would be (11 * 16^0) + (6 ^ 16^1), which equals 107.
Even though all this stuff, is pretty neat, why is it useful? If you've ever completed (or even attempted) any of the Stego or Application missions on this very website, you will realize that a hexadecimal editor is an indispensable tool. It allows you to view the binary code of the program or image (or any file, I suppose) in both Hexadecimal and ASCII text. (speaking of which, an ASCII table can also help in telling you the hex and octal codes for numbers and letters) Editing the Hex code can be a very useful tool, so that you don't necessarily have to decompile a program. Also, it's kind of fun to write messages in binary/hex/octal. I don't know why.
I hope you found this useful,
~Orwell84
Cast your vote on this article 10 - Highest, 1 - Lowest
It could probably use a bit of context or further explanation, but it does what it says on the tin, which is give a more general idea of binary/octary/hexadecimal conversion. Cool guide.
Anyone who wants to get a hands-on example can get on HTS IRC and join #bots. Most of the time my bot will be online.
you can use
!hex string
!octal string
!bin string
and
!unhex
!unoctal
!unbin
respectively.
P.S. When doing the Binary part, i used the examples on this page to make sure it was converting right :P
HackThisSite is is the collective work of the HackThisSite staff, licensed under a CC BY-NC license.
We ask that you inform us upon sharing or distributing.
Wished you would have gone into more detail on the differences between different base number systems. Altogether good job, however. 8/10