How tf does binary code work.

616 views

it’s just a bunch of 0’s and 1’s.. like I can just put a bunch of them and somehow make a sentence??? like what does this mean -> 010100101001010010 (i legit just spammed 0’s and 1’s)

In: 0

26 Answers

Anonymous 0 Comments

>How tf does binary code work.
>
>it’s just a bunch of 0’s and 1’s.

There’s really two fundamental concepts you need to understand.

One is the binary number system. You’re used to counting in decimal (base-10) – a number system with ten unique digits – because it’s what you were taught in school, and it only really exists because we have ten fingers. But you can use a number system with an arbitrary number of digits, and binary (a synonym for base-2) is one of them. And it’s easy enough to convert numbers between these number systems: 1100 in binary is 12 in decimal, or C in hexadecimal (base-16, where we use letters A-F as symbols for 10-15 in decimal) and so on. It only requires basic math to do the conversion, and people agreeing about what symbols to use for each digit so we can communicate those ideas correctly.

The second concept to understand is that “we” (smart people in the 1960s) came up with a system to map (encode) letters of the alphabet (and punctuation, etc) into numbers called ASCII. It’s entirely arbitrary, it only has meaning because we give it one. ASCII today requires that we use groups of 8 binary digits (“bits”). We can take any stream of bits, divide it into groups of 8 bits (a “byte”), and map it English characters. If it doesn’t divide evenly, or result in text that makes sense, it’s probably not ASCII data – how to interpret that data is determined by the human. ASCII is just one of many conventions that may be used.

>like I can just put a bunch of them and somehow make a sentence???

You can’t. If you’re using ASCII, you need to specify that, and follow the rules of ASCII. You need to use a multiple of 8 bits. And whatever numbers you type will be [mapped to specific characters](https://www.asciitable.com/). If you type 01010001 01011011 01111000 then that maps to “Q[x”. It doesn’t mean anything in English. I’m sure as a child you encountered puzzles that mapped A=1, B=2, … Z=26 or something. ASCII isn’t fundamentally different from that, you can’t just randomly type 478907239735 and expect other people to make sense of it.

>like what does this mean -> 010100101001010010 (i legit just spammed 0’s and 1’s)

By itself, without any context, it means nothing. You’ve typed an 18-digit number that *might* be binary, since it begins with 0 and only contains 0s and 1s (decimal numbers usually drop leading zeroes, binary numbers are usually a fixed-length because of the way electronics use them, but again that’s just a convention not a hard rule). All we know is that since it’s not a multiple of 8 digits, it’s definitely not ASCII. If you were feeding this data to a computer, it would be up to the human (user or programmer) to specify how the data should be interpreted. When you open a random file in Notepad for example, you’re telling the computer “interpret this file’s data as ASCII text”, even if it’s not (in which case it results in gibberish).

You are viewing 1 out of 26 answers, click here to view all answers.