Thursday, June 9, 2011

A Beginners Guide to Cryptography

A Little Introduction
Hello everyone, my name is Jacob (aka "Epic?") and I'm bringing you this little article on cryptography.

This article will span five parts, the first part is what you're currently in (a little introduction), the second part will cover the basics of cryptography, the third part will cover cryptographic cyphers and algorithms, the fourth part will cover cryptography applied to computer encryption, and the fifth and final part will be a short conclusion, and a guide on where you can lean more. Please note that I am writing this in the form of a paper/article, which means its going to be mostly text, however it should serve as a good learning resource for those interested in getting a brief understanding. I won't write it in a super formal way, and I'll try to make it funny/enjoyable to read, and easy to understand.

The Basics of Cryptography
Part One: An Introduction
The desire/need to protect information is as old as humanity itself. In fact, it even spans past that, it could be traced all the way back to the beginning of life as a whole. Think about it, let's say we have a brachiosaurus, as I'm sure you know, its a herbivorous dinosaur, we'll call him Brachy for short. Now, on this world of ours, everything is finite, everything from air, to water, and even the sun. We call them renewable, but there is a preset amount, and in theory, it could run out. Plants, would also be considered a finite resource, except for herbivorous dinosaurs like Brachy, its more than a resource - its food. Brachy depends on food to survive, therefore, if he finds a large amount of food, he won't want to share it with all the dinosaurs in the world, as he doesn't want his finite amount of food to run out quickly. He may want to share it with a few people, but certainly not everyone.
While dinosaurs may not have used cryptography to protect this information, and may not have shared the location of the food with his friends through encrypted data, its a similar concept to our desires today.

Here's another quick example. Let's say in ancient times, a Roman army has acquired a piece of valuable information about their enemy. Unfortunately, they can't just pick up a phone and call back to base, they could be miles away, and they didn't have phones back then. 
So they're forced to send a messenger, who will carry the message (perhaps on a paper - or even just in his mind) all the way back to base. 
Now let's think about that for a moment. All seems good, until you realize that you are miles into enemy territory, and that messenger could easily be captured. If the messenger is captured, the messenger could simply be killed (ruining the message). Or, the enemy could read the message, and then use that to plan against the Roman forces. Or, the enemy could force the messenger to take a different message, perhaps spreading false information. That, is a problem. Data intercepted ---> Data read ---> Data changed.
However, we (the Romans) could solve that simply by encrypting the message by applying some sort of encryption method to it. These "methods" are called ciphers. If we applied a cipher to the message, it would be unreadable for our enemy, and therefore our message remains concealed. So instead what may occur is Data intercepted ---> Data unable to be read ---> Data is useless to enemy

We can apply that in the modern world, to large cases, and to smaller identity theft cases. Think about it. A criminal intercepts some data online, tries to read it (tries to bypass/decrypt the encryption), and then hopefully, he fails.

Let's take another more realistic example. Let's look at a bank. Sometimes, bank records (including sensitive information) may have to be transferred back and forth, possibly through computers. On top of that, all these records have to be stored at some point (they can't just magically generate each time we want to access our bank account). These would be stored in large computer databases. 
Now think about it, this represents a major problem. For one, we will have to deal with identifying who people are. Online, we can do this through a simple password. But this presents another problem - what about people who want to break right through that password? What about.... hackers. And yes, here I am using the term "hacker" to describe a "cracker" - don't get mad at me.
Now, a hacker might start simply by trying to access the database, if its unencrypted, well, he/she is immediately in. That is very problematic. That is why we encrypt our data. 
That way, the hacker doesn't get in.
The messenger gets the message home safely.
And Brachy gets all the food for himself.

Part Two: Applying "Cryptography" - And a Glossary
Applying cryptography is simple, we do it through a cipher, which I mentioned before.

For example, look at this message:
    Apples
So, our message is "Apples". 

Now, look at a regular alphabet:
    abcdefghijklmnopqrstuvwxyz

Okay, we now have our plain text (or our message).

So, we could use a basic cipher of simply shifting each letter down one:
    bcdefghijklmnopqrstuvwxyza

Now, we have encrypted our alphabet. We have our cipher.

Which means, if we plugged our plain text (Apples) into that cipher we get:
    Bqqmft

Wow, that looks nothing like Apples. However, its relatively easy to decrypt using our cipher:
starting value = encrypted value
a = b
b = c
c = d
d = e
e = f
f = g
g = h
h = i
i = j
j = k
k = l
l = m
m = n
n = o
o = p
p = q
q = r
r = s
s = t
t = u
u = v
v = w
w = x
x = y
y = z

And if we applied that cipher, we'd get our original message back.

Now, that's all I'm going to mention on ciphers for this part (although in the next part I'll have more to say), however, one thing I will leave you with is a glossary.
These are actually two glossaries, and if ever I use a word you don't understand that's related to cryptography, it'll be in one of those.

Also, its a good read if you're looking to become serious, as it is important to learn the crypto-jargon.

Anyways:


Ciphers
Part One: A Look at Ciphers
Now as you know, cryptography is the art and science of hiding (through encryption) sensitive information/data. It includes encryption (when the cipher is initially applied to raw "plain text") and decryption (when the cipher is used to bring data back into readable form). It of course deals with passwords, applications, and such.

Here are some examples of ciphers:

Its important to understand how ciphers work before continuing in cryptography, as they are the basis of all encryption. 

Stenography is the process of writing hidden messages, which is actually more just classic cryptography, as cryptography has now become synonymous with "computer security" - as you'll read in the next section.

Remember, a cipher can be simply swapping text for numbers, or rearranging text. A cipher generally should be two ways, and be able to be used multiple times without changing results. Unless you're building a polymorphic cipher. That means, its effectively a self-modifying cipher, which I'll cover... now.

Part Two: The Idea of Polymorphism
Polymorphism is a relatively advanced part of cryptography, and is most common in computers. In a situation like this, it would probably be outside the scope of this guide, yet I feel I should cover it anyways (as its becoming more and more common).

Polymorphism is a cipher that changes itself each use, so each time it is used it produces a different result. This is most common in cipher algorithms, which are used in computers.
This means that, if we were to encrypt the same data twice, each time it would produce a different encrypted result.

Think of a key, perhaps to a car. Nowadays, we all have small electronic remotes, that unlock our cars with just a push of a button. Here's something you might not think about every time you unlock your car: an amount of data is sent to your car, and this data is specific to your car, and if it matches, then your car unlocks.
The easy way to accomplish that is simply by putting each remote-unlocker on a different frequency, however, that is difficult to regulate. So instead, all are on the same frequency, and they use different algorithms for the data sent to the car. These algorithms are polymorphic.

This means the algorithms are harder to reverse engineer, as they change each time. Even if a thief discovered the algorithm (which is harder in the first place with a polymorphic algorithm), the thief would have to match it to the same set the car/key is on - a difficult task.


Computer Encryption

Tuesday, June 7, 2011

How to Get a Player's IP Over Xbox Live


How to Get a Player's IP Address Over Xbox Live
Using Cain and Abel

Download, install, configure

Download Cain and Abel here: http://www.oxid.it/cain.html

*Note that if you virus scan it, it will appear as a virus (this is because it contains software that is virus-like/related - after all, it is a hacking tool). Don't worry, its a trusted tool, and virus free. This means you may have to turn off antiviruses on oyur computer.

Simply download the latest version, that is NOT marked as "discontinued" or "no longer supported". For me, its called "Download Cain & Abel v4.9.36 for Windows NT/2000/XP". It should be a light blue link.

When installing, just click next to all the options, and remember to install the WinPCap driver.

After you are done downloading and installing, open up the program as an administrator (right click > Run as Administrator). 

You will be taken to the main interface page.

At the top of the program in the navigation bar, click on the tab labeled "Configure".

After that, a popup box will appear titled "Configuration Dialog". There may be a few devices on your network, but they should have IP addresses of 0.0.0.0.

Click on the device name that actually has a real IP address (an IP other than 0.0.0.0). After you are done with that, make sure to check "Don't use promiscuous mode" at the bottom of the box.
Finally, click "Apply", then "Ok".



Once you have done that, you must click the Sniffer tab. Its located near the top of the page, next to other tabs (labeled Decoders, Network, Cracker, Traceroute etc.). Click the "Sniffer" tab (which is indicated with an icon and labeled "Sniffer").

Now you have to click anywhere in the white box. Then the blue plus-sign (+) will become highlighted, its between the Sniffer tab and the top navigation bar (between the Sniffer tab and the Configure/Tools tabs).

Click the blue plus sign button.

Next, a popup box will appear titled "MAC Address Scanner".
Simply click "OK".

A box will appear saying "Sniffer must be activated first!"
Just click the Sniffer, located on the left side of the biohazard symbol, or on the right side of the file symbol (the biohazard symbol is directly below the "File" tab).

Redo this process, with clicking in the white space, the blue plus, then scanning the MAC address.

It will now scan for devices, when it is done, take note of the one that says "Microsoft Corporation", as its your Xbox 360.

Next, click on the APR tab at the bottom of the page.



Now, click on the top box, not the bottom, and click on the blue plus again. The sniffer should be on, as well. Most people prefer to always keep theirs on. If its ever not on, simply turn it on.

Now, here's the most important part. You have to click on your router IP, on the left side, then IPs will pop up on the right side of the box. You now want to click the IP that is your xbox, on the right side. It is the one that corresponds with the IP you wrote down, or just memorized, before, in this tutorial.



Your router IP is going to be the shorter one, as you see in the picture.
**NOTE: You will have a MAC address for your router.

After you have clicked your router IP, then your Xbox IP, just click "OK".

You are now ready to get player IPs.


Get the IPs

You can now easily and successfully get the IP of anyone who plays with you (in-game, in party chat, private chat, etc.).

All you have to do now, is every time you want to see players' IPs, just click the biochemical symbol, or the "Start/Stop APR" symbol. The players' IPs will appear in the bottom white box (sniffer has to be on before you start the APR, though).



The IPs of the actual players will be the IP's on the far right column, not the one where almost all the IP's are the same.


What to do with the IPs

You could trace their IP if you wanted to, in order to find the general location in which they lived. Or, if you have access to more advanced, government technology, you could potentially find out exactly where they live. 

You can use their IP to load hacks (such as viruses, malware, spyware, etc.) against their computers.

You could DoS/DDoS their IP (which is the most common solution). This will remove them from the game (or cause them extreme lag). That will guarantee you the win.

Friday, June 3, 2011

A Little Bit About Crypters

What are Crypters?
The term "crypter" is derived from the term "encryption". The purpose of a crypter is to crypt (or encrypt) data, generally speaking, computer programs. The basic goal of a crypter (or any form of encryption) is to take some form of data and encrypt it so that to the normal eye it is incomprehensible and nonsensical, and then give it the ability to be decrypted, and put back into comprehensible and sensible terms.

We do this through a cipher. A cipher is a common term when it comes to code/encryption. We use the cipher to encrypt and decrypt various messages, for example, the cipher might be to shift every letter down one (for example: a would become b, b to c, c to d, and so on).
Nowadays, we do this all the time on computers. Its important that what we put on computers is secure (as I don't want my credit card number to be read by everyone each time I put it in Amazon).

However, nowadays we use a bit more complex ciphers than just shifting each letter down one. We now call our ciphers, algorithms. Algorithms are sort of like mathematical formulas that can be applied to data and encrypt and decrypt it. For example, the algorithm of the shifting cipher I showed you, would simply be to add +1 to each character's value of the alphabet. Of course, in algorithms we mostly deal with numbers, as you can have an infinite amount of numbers, but only 26 in the standard alphabet.

Now crypters go beyond just encrypting random data, we use them to actually encrypt programs - concealing the identity of the program. We do this mostly to pass off viruses as clean/goodware. By encrypting the program, we can avoid detection by the user, and by the antivirus software the user may have in place. Of course, there are other types of crypters, and even other uses of program/application crypters - however that's their most common use.

If you've been on HackForums.net any time, you'll certainly have realized that crypters are a major part of black-hat (malicious) hacking.

How do they work?
Crypters work by crypting (encrypting) the data (bits) of a program. It works by applying an encryption algorithm (basically a cipher of sorts) to the actual code of the program, then reassembling the program into a working form. There are generally two parts to a crypter. There's the GUI with which we interact with, often called the Client. The other part is the stub, this is the part that actually gets the file we put into the GUI and encrypts it, then decrypts it when it comes time.

What's the difference between a crypter, a packer, and a binder?
A crypter encrypts your files, while a packer packs your files with the intention of making them smaller in size and sometimes avoiding scantime detection (you'll learn that later). A binder binds two files together, making something like a picture actually turn out to be the virus.

Learning the Lingo....
Scantime - A ScanTime crypter encrypts the file so antiviruses won't be able to analyze the file before execution, not when executed (when the file is first scanned by the antivirus).
Runtime - A RunTime crypter encrypts the file so that when executed (when it is run by the user), it is decrypted in the memory. This way antiviruses can't analyze the file before and after executed. A RunTime is typically more secure than a ScanTime - generally good crypters are both ScanTime and RunTime.
EOF - EOF stands for End of File. Some malicious files (such as Bifrost, Medusa, or Cybergate) require the end of file data in order to run without being corrupted. If crypters don't preserve this end of file data, the crypted file would become corrupt.
USG - A USG is part of a special type of crypter. It generates a unique version of the stub (hence the name Unique Stub Generator) each time used. The purpose of this is to help FUD crypters.
Stub - The stub is part of the crypter used to encrypt and decrypt the specified encrypted file.
Client - The client is the GUI of the crypter, its what users interact with and upload their file to.
Antis - Antis (anti's) are extra features found on some crypters. They are dedicated to bypassing/preventing a specific thing. For example, an anti-debugger might prevent it from being debugged, and an anti-avira would specifically protect against being detected by the antivirus called "Avira".
File pumper - A file pumper "pumps" your file, meaning it adds more bytes to a file to make it appear larger. The benefit of this is not usually great, however it can be useful, and you might even lose a detection.
FUD - FUD stands for Fully Undetectable. A FUD crypter is completely undetected by all antiviruses. UD stands for Undetected, meaning the crypter is mostly undetectable on most antiviruses. Nobody uses the term D (they just say "detected" or "no longer working") however in theory that would stand for a completely detectable crypter on virtually all antivirus systems.

How do I test if my crypter is undetectable?
The easiest way is to virus scan it on multi-antivirus scanners. This will allow you to scan it to multiple antiviruses, to check whether its truly FUD, or if its just undetected on your own antivirus. This also prevents the risk of data being sent from the antivirus on your computer to the antivirus company (this would immediately un-FUD your crypter). Simply go to http://scanner.novirusthanks.org or http://virustotal.org.
Those are free, online multi-antivirus scanners. Be sure to check the "Do Not Distribute" (or similar) option. This will prevent the website from distributing the results of the scan to the antivirus companies, keeping your crypter FUD.
However, realize that all crypters eventually become detected.

How do antiviruses detect my crypter? How does my crypter prevent this?
An antivirus works by scanning files. An executable file (EXE) is simply made up of lines of instructions, each line called an "offset":
View of Hex Workshop --- Demonstrates the offsets

From there, the antivirus (which has massive databases of these lines that are known to be associated with malicious files) scan through the file submitted to the antivirus and check for matches. Obviously, if there is a match, then the program is flagged as having a virus.

Therefore, our crypter will have to do the following:

Simply put, a crypter needs to take in an infected file, encrypt it, and place it at the bottom of what appears to be a virus-free file called your stub, and then the stub file extracts the encrypted data from itself and decrypts it. Thus it is then  extracted and run. Now, if your stub becomes detected, all files encrypted into this stub will become detected and flagged.


How do I make my crypter FUD?
There are many popular techniques to FUDing a crypter. Of course, your first step is to either acquire a crypter, or develop your own (which is outside the scope of this tutorial).

Our first option will be changing assembly information. To do this, we'd need to change the compilation settings for the EXE. We could change the file version, description, and more. We should also change things like variable names, and method names, those are all things that can be detected by an antivirus. We can also switch around the order a methods are in. Another option we can take is to find a way to accomplish the same task in a different way. For example, in real life, we could walk three feet, but it would really throw someone off if we instead jumped three feet everywhere we went. We can do the same to antiviruses by accomplishing the same task in a different manner.

Also, don't forget simple stuff. Adding junk code to modify the flow can confuse an antivirus. Changing the order of code aspects. Manipulating strings. Renaming the file. Adding or changing the icon.

Basically, just change things up.

The other thing you have to understand is the signatures of antiviruses. These are what they check for in a program, specific telltale signatures left behind by malicious programs. There are specific signatures and broad signatures. 
The key to each is discovery. 

With these specific signatures we simply section off parts of the code. Cut the code in half, scan both halves, see which side the detection is coming from, then split that in half, and so on. Eventually you'll come down to the section being detected (or even just the line being detected) and you can rework it.

If you have a broad detection, it means you have a common flaw. I'd suggest you use the "change it up" method I suggested earlier. Generally, its something specific still setting off this broad detection, and you can narrow it down like mentioned before.


Numbers: Decimal, Binary, Hexadecimal

Numbers with Epic?
(but you can call me Jacob)

Numbers, you love 'em, right? Oh I see, you're not a nerd, well good thing I'm here to explain this to you.
Now, I know what you're thinking, "pointless thread is pointless" - but don't jump to conclusions.
What I'm going to be talking about is the basics of the decimal, binary, and hexadecimal numbers, this may seem foreign to you, so I'm going to start with the complete basics and work our way up to at least a fundamental understanding. I know that may seem pointless to you, but since there's a decent chance you're interested in learning about computers, this might not be so pointless.

For those of you who are trying to be "hackers" or even "programmers" this is a wonderful place to start. Also for those of you trying to reverse engineer in PPC, another good place to start.

I posted this in the hardware section because I talk about Machine Code, and binary. Even PowerPC (which is used on Xbox 360, PlayStation 3, Wii, and old Macs) is very hardware based. If you feel it should be moved, please leave it up to a moderator, they will move it. Thanks!



Machine Code

The first concept we'll have to understand is that of Machine Code. Machine code is the code your computer actually runs. It does not understand any language, not English, Spanish, French, Japanese, Chinese, or any other spoken language. It also doesn't understand C, C++, or C#, or whatever language you know. It solely understands binary. Sure, you can think of binary as a language, but it only has two characters.

Binary is comprised of ones and noughts (BASICALLY: Ones and Zeros), the ones and zeros that represent these ones and noughts are the "two characters" I mentioned earlier. Back in the beginning of the time of computers, everything was written in binary machine code. Nowadays we no longer write in binary (thank god!), we usually use assemblers or compilers that can transform our code (like C) into machine code (binary) for the computer to use.

Fun Fact! Binary's ones and noughts are actually represented to the computer through electrical signals. A one would represent an "on" signal (a strong signal) whereas a zero/nought would represent an "off" signal (although in most cases not completely off, just reduced strength) and these are indeed transmitted through electrical currents.

Here's something you need to understand, binary is written in series of ones and noughts to form an instruction. These instructions are called "words". A word is made up of 32-digits (of binary), or bits. So you could think of one word being equal to 32-bits. The pattern of the binary in the word tells the processor how to execute (or run) the word/instruction. The programs we see today are made of many words strung together.

Now, I just whipped a word at you: processor. I won't go far in depth, but the goal of the processor is to take in data (input) and perform some sort of processing on said data, then store that data in a useful way, thus giving you the output. So basically, user/programmer enters data input, processor executes or processes the data, processor stores the data output in a way useful to the user/programmer. Something to understand is that processors need temporary storage within itself called registers. A language called PowerPC (often abbreviated to PPC) is used in the Xbox 360, PlayStation 3, Wii, and old Macs. I don't know how much you know, but ever since the "hacked" version of the xbox called a "jtag" was banned from being online, people have been trying to create a new method of coming online using PPC. PowerPC has 2 types of registers: integers (defined as r0 to r31) and floating points (defined as f0 to f31), floating points are one of the most powerful aspects of PPC. But let's get back on topic...

What does digital mean? Well, digital means numerical (the root of that word is number). Now, that idea isn't something vitally important right now, but keep that in mind. Now we can't just input a decimal number to a computer and expect something to work, just as the instructions executed by a computer are stored in binary, so are actual numbers. 



Decimal/Decimary Numbers
BUT WAIT! What's a decimal number? Do you mean like 1.2? Nope, the "." is a decimal point, a decimal number is comprised of 10 (deci) possible digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9 (0 to 9). This is what I call the "normal" numeric system, because this is what we usually see. We all can recognize 10 as ten, even though in binary 10 (pronounced "one zero" not "ten") is a 2 (if you were thinking in decimal to binary you'd say 2 = 10).

So... how do we actually take these "normal" decimal (the system is actually called denary, so learn the denary system, some call this the "human denary system") numbers and put them into binary? Well, good question!

Lets start by looking at the denary system we all know and love. We start counting at zero (0) and we can easily count up to ten, eventually we reach 11 (eleven), which is 10 plus 1, and then we reach 101, meaning one hundred, no tens, and one unit of one. If we use the term multipliers to describe tens, hundreds, and thousands, then any number can be expressed in terms of its multipliers. The decimary number 1234 could be expressed as:
1 times 10^3 (one multiplied by ten to the third power)
2 times 10^2
3 times 10 ^1
4
That would basically describe the number 1234 in the decimary system.
Please remember, that the carrot symbol (^) is to denote "to the power of".

Did I lose you yet? Well, I hope not. Lets break down what I just showed you (the 1234 example), lets just look at the thousands place. The thousands place is a 1 in the decimary system (1234). Since its in the thousands place, that one does not represent an actual one, but a one-thousand (1000). 10 to the third power (10 times 10 times 10) is equal to 1000. 1 multiplied by 1000 is equal to 1000, thus making that make sense:
1 (times) 10^3 is equal to 1000, which is the value of the 1 in the thousands place.

C'mon, you better not be confused, we're talking normal numbers here!



Binary

Now, let's switch over to binary (oh no!). Don't be concerned its actually quite simple.

Remember our fun fact? Binary is used by computers at the basic level of machine code, it is represented through ones and noughts (ones and zeros). These are actually electrical signals sent to the processor, the one is an on and the zero is an off!

Computers use binary, not denary, thus making it important to understand the fundamentals of binary. In binary numbers are expressed as powers of 2 instead of 10. In denary multipliers go 1, 10, 100, 1000, 10000 and so on, whereas in binary the multipliers go 1, 2, 4, 8, 16, 32, 64, 128, 256 and so on.

Let me start by saying that it can be helpful to remember some of the multipliers, at least the first few. I'm not saying you have to memorize them, but if you're serious, consider it, here's some to learn:

1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536

Alright, lets start by trying to express the decimary number 13 (thirteen) in binary.
Break it down into powers of two.
13 is one 8, one 4, and one 1.

Look at this chart:
8 4 2 1
1 1 0 1

Thus 13 is 1101 in binary. Confused? Don't worry, that example could be kinda rough, lets take a minute to talk about some vocab, and then move on to another example.

Binary digits (1 and 0) are termed "bits", its a short form of "binary digit". So instead of saying binary digit, just say bit. Sometimes in a word (remember that vocab term?) you may need to locate a group of bits. Bits are numbered from zero upwards, the bit zero is the rightmost bit. For example:
76543210 - 7 would be the first bit in that string, and 0 would be the last bit, so you could call that first bit "Bit 7" and the last bit "Bit 0".

Back on topic...

Lets convert to binary! Yay!

Convert the decimary number 255 to binary. Don't look below at the work/answer, think about it, try it yourself, then take a peak below at my answer.

Start with the multiplier above 255, which happens to be 256. 256 is to big (to great) of a number, so try 128.
255 divided by 128=1 remainder 127. So we have a 128.
127 divided by 64 =1 remainder 63.
63 divided by 32 = 1 remainder 31
31 divided by 16 = 1 remainder 15
15 divided by 8 = 1 remainder 7
7 divided by 4 = 1 remainder 3
3 divided by 2 = 1 remainder 1
1 divided by 1 = 1 remainder 0

Therefore 255 in binary is 11111111 (8 ones). You can count it up:
1. 255 divided by 128=1 remainder 127. So we have a 128.
2. 127 divided by 64 =1 remainder 63.
3. 63 divided by 32 = 1 remainder 31
4. 31 divided by 16 = 1 remainder 15
5. 15 divided by 8 = 1 remainder 7
6. 7 divided by 4 = 1 remainder 3
7. 3 divided by 2 = 1 remainder 1
8. 1 divided by 1 = 1 remainder 0

Let's do another example if you're still confused. Let's do the decimary number 471. The multiplier 512 is a bit too big, so lets do 256.
Here's the math:
471 divided by 256 = 1 remainder 215
215 divided by 128 = 1 remainder 87
83 divided by 64 = 1 remainder 23
23 divided by 32 = 0 (because 32 doesn't divide into 23 even once. i.e. it won't "go")
23 divided by 16 = 1 remainder 9
7 divided by 8 = 0 (because it won't go)
7 divided by 4 = 1 remainder 3
3 divided by 2 = 1 remainder 1
1 divided by 1 = 1

So we see that 471 when put into binary is 111010111. That is nine bits.

Basically that means:
1*1 + 1*2 + 1*4 + 1*16 + 1*64 + 1*128 + 1*256 = 471 (the asterisk "*" represents multiplication)
OR
1 + 2 + 4 + 16 + 64 + 128 + 256 = 471

Here are a few more examples:
128 64 32 16 8 4 2 1
25 = 0 0 0 1 1 0 0 1
129= 1 0 0 0 0 0 0 1
56 = 0 0 1 1 1 0 0 0
90 = 0 1 0 1 1 0 1 0

If you don't get/want to use that chart, its okay, just make sure you understand how to convert between decimary and binary.

Hexadecimal

Okay, if you looked at the title of this thread before clicking on it you would have noticed "Decimal, Binary, Hexadecimal". Well, we covered decimal and binary, what about hexadecimal? Well, lets jump right in...

Hexadecimal is commonly seen when reverse engineering programs, and especially in PPC (PowerPC, which I discussed earlier), therefore its important to discuss the basics. You'll also witness the hexadecimal system in chip-programming/logic (if you were to ever create a "rapid fire" chip mod for your controller to a gaming console).

Hexadecimal is usually referred to as "hex" (ever heard of hex codes?). Hex is a numerical system, just like decimal or binary. Anyone remember from elementary school what hex refers to? Well a hexagon has six sides, so hex must mean six!


In the decimary system we had a base of 10 (the digits 0-9), in binary we had a base of 2 (digits 0-1), and in hex we have a base of 16. Just something to point out: deci means ten, bi means two, and hex means six. 
So hold up. We have this little issue here, hex has a base of 16, but "hex" only refers to "six". Well you're forgetting the full name for hex is actually hexadecimal, hex menaing six, and deci meaning ten. 6 + 10 = 16.

Now I know what you're thinking:
When you say a "base of 10" you use 10 different single digits, when you say "base of 16" you must mean that you use 16 different single digits, but there are only 10 different single digits! Therefore, hex is clearly impossible!

Slow down there cowboy. Hex extends to 15 (not 16 because we're including 0) by using letters (specifically the letters A to F).

If you can understand binary, you won't have to worry much about hex. SOMETHING YOU NEED TO KNOW - or the next part won't make any sense: Each hex digit represents 4 bits (also called a nibble).

Here's an example:

255 in binary is 11111111 (8 ones - we already did this, remember?)

To get 255 in hex, first convert to binary, then split up into nibbles (4 bits):
1111 1111
(4 ones) (4 ones)

Each hex digit is a niblle, so 1111 is binary for 15 in decimal, or F in hexadecimal. To show this hex number in code we usually precede it with a dollar sign ($) or the C language standard of "0x". So if you were in the C language, you might say "0xFF" for the number 255.

Lets convert FACE to decimal - 

F 1111
A 1010
C 1100
E 1110

Go on, convert! 

Answer: 64206.

So by now you should understand binary, decimal, and hexadecimal. Enjoy!

If you want more number systems, check out this wikipedia page: http://en.wikipedia.org/wiki/List_of_numeral_systems

There's actually quite a few very neat numerical systems if you want to check them out. Many of them are very job-specific.

So, Why did you read this whole thing?
Well aside from the fact that you probably had a lot of time to kill, you now have a deeper understanding of numerical systems, and how they work, as well as how machines use them.