Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Understand binary and how to write it

I have no idea where this should be posted actually rofl.
I was a bit bored and though I'd do a quick tutorial on how to read and write binary, but as well how to write messages in it.

First of all I'm sure you all know how binary works. It's just a bunch of 1's and 0's. Well no, it's not just a bunch of 0's and 1's. These numbers represents something which is called bits. Some people confuses bits with bytes, but they're not the same. A byte is actually 8 bits.

So what are the 0's and 1's then? Basically you can see bits as lightbulps. Either they're on or off, which also can be said to be true or false.

You read a binary digit from right to left starting with the highest bit controller and then to the lowest.
This is the structure:
[Image: J2dXMzM.png]

So here we have an empty byte:
[Image: kKSQG1T.png]

To represent a number we have to either set these numbers on or off. We can do that by replacing the 0's with 1's. (0 represents off, 1 represents on)

So if we wanted to represent the number 1 then we'd just turns on the last bit (As I said binary starts from higest to lowest.)
[img]http://img89.imageshack.us/img89/4354/aa584fe8d96c4af9872cbcc.png[/img]

So how do you think we represent the number 2?
That is correct we just turns on the second last bit.
[Image: XJHdaJN.png]

But what if we wanted to represent the number 5?
You don't see a number 5 here, do you?
[Image: J2dXMzM.png]

This is where math plays a role.
Think of 2 numbers that makes 5...

Though of any yet?
4 + 1 does. If we then turns the bits on that represents 4 and 1, well guess what that represents 5.
[img]http://img715.imageshack.us/img715/407/0973d58804ad4ed097e5c32.png[/img]

Now you should be able to understand how to write numbers using binary.
Then let's take a look at writing messages.
We know that 1 byte represents 8 bits. Now to understand how to write messages then you need to understand a character represents 1 byte.
So a byte is basically equal to a character.

We'll take a look at ASCII now.
Take a look at this:
[img]http://www.asciitable.com/index/asciifull.gif[/img]

That is the ASCII character table.
We'll be focusing on the column "DEC" and the column "CHAR".

Now I'm not trying to make you memorize the whole ASCII table, because that might be hard.

Instead of trying to remember what decimal each character represent then try to group the table which it already is.

(Signed byte)
Non-characters goes from 0-31.
Characters-A goes from 32-47
Numbers goes from 48-57
Characters-B goes from 58-64
Upper-case characters goes from 65-90
Characters-C goes from 91-96
Lower-case characters goes fom 97-122
Characters-D goes from 123-126
Delete is 127
(Unsigned byte)
Extended characters goes from 128-255

Now if you can learn the basic groups. Numbers, Uper-case characters and Lower-case characters. Just their start offsets then you can already write messages.

If you know the alphabet that is.

The decimal column represents the number of bits the byte should be.
Ex. A would be represented by the number 65.
This would be the binary number for A:
[Image: hpGW3pR.png]

Because 64 + 1 = 65.

So if you've learned how to memorize the groups of the ASCII table then you should be able to find the next character for your message.
As you already know Upper-cases starts at 65 and Lower-case at 97.
Then let's say we want F. Then we just start from A (65) and then counts one up untill we reach F.

Try to see if you can understand this message without using a translator!
http://justpaste.it/24vd

I hope this helped you learning and understanding binary.
Heh, reminds me of learning base conversion back in University. Nice tutorial. Though - simplifying conversion between decimal and binary can be a lot simpler with a mathematical formula.

Take the decimal (base10) number you want to convert to binary and divide it by 2 (binary has a base of 2). If there is a remainder write down a 1. If there is no remainder, write down a 0. Take the new number (without the remainder) and divide by 2 again. Write down the remainder of 1 or a 0 (depending on if there's a remainder or not) to the left of the previous number you wrote down. Keep doing this until you have nothing left to divide (your original number is 0).
(Mar 6, 2013 07:31 PM)~Dec Wrote:  Heh, reminds me of learning base conversion back in University. Nice tutorial. Though - simplifying conversion between decimal and binary can be a lot simpler with a mathematical formula.

Take the decimal (base10) number you want to convert to binary and divide it by 2 (binary has a base of 2). If there is a remainder write down a 1. If there is no remainder, write down a 0. Take the new number (without the remainder) and divide by 2 again. Write down the remainder of 1 or a 0 (depending on if there's a remainder or not) to the left of the previous number you wrote down. Keep doing this until you have nothing left to divide (your original number is 0).

Yeah this might be a useful way to do it.
Looks good OP. But I am confused, isnt a byte 8 bits, so how can Upper case A be 65 bits? I know binary, just seeinf of you noticed how you worded it. I know what you meant, but those new to binary may not.

~ Singularity ~
[Image: 9N6Aq1f.gif]

(Mar 7, 2013 05:04 PM)vitafortis Wrote:  Looks good OP. But I am confused, isnt a byte 8 bits, so how can Upper case A be 65 bits? I know binary, just seeinf of you noticed how you worded it. I know what you meant, but those new to binary may not.

It's not 65 bits. A byte (signed) can take up to the value 128 which represents 8 bits. I may look through my tutorial later if I feel like it, to reword a few things if it is?
(Mar 7, 2013 05:10 PM)BaussHacker Wrote:  It's not 65 bits. A byte (signed) can take up to the value 128 which represents 8 bits.

Oh I know. But look at your OP. You said A is 65 bits. Thats all I was trying to point out.

~ Singularity ~
[Image: 9N6Aq1f.gif]

(Mar 7, 2013 05:11 PM)vitafortis Wrote:  Oh I know. But look at your OP. You said A is 65 bits. Thats all I was trying to point out.

Òh, well I will reword it ASAP. Thanks for pointing it out!
(Mar 7, 2013 05:12 PM)BaussHacker Wrote:  Òh, well I will reword it ASAP. Thanks for pointing it out!

Not a problem, thank you for taking the time to type this up.

~ Singularity ~
[Image: 9N6Aq1f.gif]



Possibly Related Threads...
Thread / Author Replies Views Last Post
[Assembly] by ayleid96May 12, 2013 02:45 PM 18 729 May 12, 2013 02:45 PM
Last Post: notsteve