S0C13TY

S0C13TY

There's Something About Binary

How does binary work?

Computers are essentially built out of on/off switches (electricity in a wire is either "On" = 1 or "Off" = 0). Each of these binary switches is known as a "bit" and if you stick them together you can represent bigger numbers.

e.g. with 2 switches you can count 4 things (if you consider 0 to be a number):

Bit 2 Bit 1    
  0 = 0
  1 = 1
1 0 = 2
1 1 = 3

Add another switch and you can count up to 8 things (7 + "0")

Bit 3 Bit 2 Bit 1    
1 0 0 = 4
1 0 1 = 5
1 1 0 = 6
1 1 1 = 7

etc, etc.

Bytes

Computers generally cluster bits together into "bytes" - an 8bit computer has bytes representing numbers up to 256, but a 16bit machine can handle numbers up to 65,536 and so on.

If you have an 8 bit computer "just" counting up to 200 would be a waste of space, so that's why most figures you read around computer science utilise all the switches, i.e. are multiples of 2: "256" or "512" or "1024" etc

Hex

Writing binary out long-hand is crap, so hexadecimal was created as a shorthand.

Binary Table

Here are the first 256, 8 bit binary numbers:

0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
00000000 00000001 00000001 00000011 00000001 00000101 00000011 00000111 00000001 00001001 00000101 00001101 00000011 00001011 00000111 00001111 00000001 00010001 00001001 00011001 00000101 00010101 00001101 00011101 00000011 00010011 00001011 00011011 00000111 00010111 00001111 00011111 00000001 00100001 00010001 00110001 00001001 00101001 00011001 00111001 00000101 00100101 00010101 00110101 00001101 00101101 00011101 00111101 00000011 00100011 00010011 00110011 00001011 00101011 00011011 00111011 00000111 00100111 00010111 00110111 00001111 00101111 00011111 00111111 00000001 01000001 00100001 01100001 00010001 01010001 00110001 01110001 00001001 01001001 00101001 01101001 00011001 01011001 00111001 01111001 00000101 01000101 00100101 01100101 00010101 01010101 00110101 01110101 00001101 01001101 00101101 01101101 00011101 01011101 00111101 01111101 00000011 01000011 00100011 01100011 00010011 01010011 00110011 01110011 00001011 01001011 00101011 01101011 00011011 01011011 00111011 01111011 00000111 01000111 00100111 01100111 00010111 01010111 00110111 01110111 00001111 01001111 00101111 01101111 00011111 01011111 00111111 01111111 00000001 10000001 01000001 11000001 00100001 10100001 01100001 11100001 00010001 10010001 01010001 11010001 00110001 10110001 01110001 11110001 00001001 10001001 01001001 11001001 00101001 10101001 01101001 11101001 00011001 10011001 01011001 11011001 00111001 10111001 01111001 11111001 00000101 10000101 01000101 11000101 00100101 10100101 01100101 11100101 00010101 10010101 01010101 11010101 00110101 10110101 01110101 11110101 00001101 10001101 01001101 11001101 00101101 10101101 01101101 11101101 00011101 10011101 01011101 11011101 00111101 10111101 01111101 11111101 00000011 10000011 01000011 11000011 00100011 10100011 01100011 11100011 00010011 10010011 01010011 11010011 00110011 10110011 01110011 11110011 00001011 10001011 01001011 11001011 00101011 10101011 01101011 11101011 00011011 10011011 01011011 11011011 00111011 10111011 01111011 11111011 00000111 10000111 01000111 11000111 00100111 10100111 01100111 11100111 00010111 10010111 01010111 11010111 00110111 10110111 01110111 11110111 00001111 10001111 01001111 11001111 00101111 10101111 01101111 11101111 00011111 10011111 01011111 11011111 00111111 10111111 01111111 11111111