Hack Forums

Full Version: Binary Tutorial
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Well, I got bored last night and decided to make a really simple introduction to binary. I did a quick search and didn't find a thread on this topic. Sorry if someone already did it.

Anyway, if you have trouble with regular numbers (decimal) then you might have a problem here. Otherwise, binary should be a breeze.




1.Intro

Binary works the exact same way decimal does-start from the right.
X * y^position. Except binary can have 0-1 for X and decimal can have 0-10. And, binary uses 2 for y and decimal uses 10
Simple. Anyway, think of the decimal number 11. Ok, read it from right to left and using the method above. X * Y^P. X is the first number when read right to left. So, 1 * Y^P. Y is 10 in decimal. So, 1 * 10^P. P is the position and sense its the first one, the position number is 0. So, you have this --- 1 * 10^0. Remember the order of operations, exponents first. 1 * 1 = 1. Ok, so the first digit is equal to one. Well, you already knew that but it helps you see the number differently. So, we have - 1. We still have to do the next digit number. X * Y^P. Position increases from right to left so its = 1 * 10^1. This is 1 * 10. 10. We add together our findings = 1 + 10 = 11. Very simple. Binary is even simpler. Because, you don't have to increase by 10x; only 2x. Now that you know how numbers work, lets move on to converting binary to decimal.




2.Converting Binary to Decimal

First, get a binary number. I pick 10101. Now, write it vertically.
1
1
0
1

Good. Now, start from the bottom and use X * Y^P.
Remember. Y is 2 in binary.
1 * 2^0 = 1*1=1
0 * 2^1 = 0*2=0
1 * 2^2 = 1*4=4
1 * 2^3 = 1*8=8
Now, add up your findings again. 1+4+8=13.
Walah. 1101 = 13.
Practice on this number.
110001.
I'll write the answer in a spoiler so you can see if you are right.

The answer (Click to View)

It will probably help you greatly to memorize the base 2 thing.
2 4 8 16 32 64 128 256.
This way, you can just associate each one with the digit they belong with and only add them if there is a 1 in that digit and ignore them otherwise.
Like this

16 8 4 2
1 0 0 1
You only add the ones with a one So, it would be like 16+2=18.




3.Converting Decimal to Binary

Now, to convert decimal to binary.
There are two ways to do it and I will be showing the easier of the two.
Write your number.

X
divide by two
X/2
If there is a remainder, write down a 1 if not, write a 0.
(If you have a remainder, round the number down.)
100
50-0
25-0
12.5-1
12
6-0
3-0
1.5-1
1
0.5-1
Your number is 0010011. But, you have to flip it. Then it becomes 1100100.




4.Practice

You can practice with a sheet of paper. I do not recommend doing this with a computer program-text editor because you have to write the first digit first and then the second and if you do that with notepad (or any other text editor on a computer) then it will be backwards. And, if you remember to keep moving to the left before you do your next digit then you will be fine but, you might mess up and get really confused. Anyway, if you need to check your work, then open up the calculator on your computer and hit view>scientific view.
Then type in your decimal number and hit bin.
[Image: 2090054ed0e02cb73adfae585855519af6d76da.jpg]
(Where it shows in the picture)
And, your decimal number will suddenly be in binary.
This also works vise versa.
It helps to practice whenever you can. The more you practice, the faster and more accurate you will become.
You will eventually be able to do this in your head.

---------------------------------------------------------------------------
If you need some sites that will translate binary-text and vise versa use these.

http://www.nickciske.com/tools/binary.php
http://www.paulschou.com/tools/xlate/



I hope I helped Yeye
Anyone? An opinion please.
I've been looking for something like this for ages, thanks.
t3h-death-cap Wrote:I've been looking for something like this for ages, thanks.

Glad to help Biggrin Yeye
What could binary be used for exactly? I know its the root of all data and programming etc., but how could it be useful?
mango Wrote:What could binary be used for exactly? I know its the root of all data and programming etc., but how could it be useful?

In confusing people who don't know it.
You could write 'you are dumb' in binary and when people ask what it is, tell them 'you are dumb'
And, its one step closer to becoming a complete computer nerd.
matt_familyguy Wrote:
mango Wrote:What could binary be used for exactly? I know its the root of all data and programming etc., but how could it be useful?

In confusing people who don't know it.
You could write 'you are dumb' in binary and when people ask what it is, tell them 'you are dumb'
And, its one step closer to becoming a complete computer nerd.

Fucking Sweet.
I know!

And, when you learn binary it feels like learning another computer language.
I feel all excited inside Roflmao Yeye
Thanks man this was a great help. A decent post from a decent member *Thumbs up*
f1r3w4ll Wrote:Thanks man this was a great help. A decent post from a decent member *Thumbs up*

Thanks Yeye
Pages: 1 2 3 4 5 6
Reference URL's