Binary code is a system of representing text or computer processor instructions using the binary number system, which consists of only two numbers: 0 and 1. Each digit in this system is referred to as a bit.
Basics of Binary Code:
 Binary Digits (Bits): The smallest unit of data in a binary code, represented as either 0 or 1.
 Byte: A group of 8 bits. For example, the binary sequence
01000001
represents the letter ‘A’ in ASCII code.  Binary to Decimal Conversion: Binary numbers can be converted to decimal by summing the products of each bit (0 or 1) and its corresponding power of 2. For example, the binary number
1101
equals $1∗_{3}+1∗_{2}+0∗_{1}+1∗_{0}=8+4+0+1=13$.
Uses of Binary Code:
 Computers: The primary language of computers, allowing them to process instructions and data.
 Digital Systems: Used in various digital systems like calculators, digital watches, and more.
 Encoding Data: Binary code encodes text, images, audio, and video data in digital formats.
Examples:
 Text Representation:
 The letter ‘A’ in binary:
01000001
 The letter ‘B’ in binary:
01000010
 The letter ‘A’ in binary:
 Binary Arithmetic:
 Adding binary numbers:
1010
(10 in decimal) +0110
(6 in decimal) =10000
(16 in decimal)
 Adding binary numbers:
Binary Code in ASCII: The American Standard Code for Information Interchange (ASCII) uses binary code to represent text characters. Each character is assigned a unique 7 or 8bit binary number.
For instance:
 ‘A’ is
01000001
 ‘B’ is
01000010
 ‘C’ is
01000011
Decimal to Binary Number System
The Decimal to binary number system, also known as the base2 number system, uses only two digits: 0 and 1. It is the foundation of all modern computer systems and digital electronics.
Understanding Binary Numbers: In the binary system, each digit represents a power of 2, starting from $_{0}$ on the right. Here is the place value for an 8bit binary number (which has 8 digits):
128 64 32 16 8 4 2 1
2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
Writing Binary Numbers: To convert a decimal (base10) number to binary (base2), follow these steps:
 Find the highest power of 2 less than or equal to the decimal number.
 Subtract this power of 2 from the decimal number.
 Repeat the process with the remainder until you reach 0.
Example Conversion: Let’s convert the decimal number 13 to binary.

The highest power of 2 less than or equal to 13 is $_{3}=8$.
 Write down 1 for $_{3}$.
 Subtract 8 from 13, leaving a remainder of 5.
 So far:
1

The next highest power of 2 less than or equal to 5 is $_{2}=4$.
 Write down 1 for $_{2}$.
 Subtract 4 from 5, leaving a remainder of 1.
 So far:
11

The next highest power of 2 less than or equal to 1 is $_{0}=1$.
 Write down 1 for $_{0}$.
 Subtract 1 from 1, leaving a remainder of 0.
 So far:
1101
Now, combine all the binary digits from left to right: 1101.
So, 13 in decimal is 1101 in binary.
Example Table
Here’s a table of the first few decimal to binario numbers equivalents:
Decimal  Binary 

0  0 
1  1 
2  10 
3  11 
4  100 
5  101 
6  110 
7  111 
8  1000 
9  1001 
10  1010 
11  1011 
12  1100 
13  1101 
14  1110 
15  1111 
Creating a Simple Substitution Cipher

Choose a Key: This is a rule or a table that determines how each letter in the plaintext (original text) is substituted with a letter in the ciphertext (encoded text).

Create a Cipher Alphabet: This is a scrambled version of the regular alphabet. For example, you might shift each letter by a certain number of places in the alphabet (Caesar cipher), or use a completely random order.
Example: Caesar Cipher with a Shift of 3
Plain Alphabet: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher Alphabet: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
In this example, A becomes D, B becomes E, C becomes F, and so on.
Encoding a Message: Let’s encode the word “HELLO” using the Caesar cipher with a shift of 3:
 H → K
 E → H
 L → O
 L → O
 O → R
So, “HELLO” becomes “KHOOR”.
Decoding a Message: To decode a message, simply reverse the process. Using the Caesar cipher with a shift of 3:
 K → H
 H → E
 O → L
 O → L
 R → O
So, “KHOOR” becomes “HELLO”.
Example: Random Substitution Cipher
You can also use a completely random substitution for more security. Here’s an example of a random substitution cipher:
Plain Alphabet: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher Alphabet: Q W E R T Y U I O P A S D F G H J K L Z X C V B N M
Using this cipher, let’s encode “SECRET”:
 S → A
 E → T
 C → E
 R → K
 E → T
 T → Z
So, “SECRET” becomes “ATEKTZ”.
Practice with Your Cipher
 Choose a method: Decide if you want a Caesar cipher, random substitution, or another method.
 Create your cipher alphabet: Write down your rules or table.
 Encode a message: Use your rules to convert each letter of your message.
 Decode a message: Reverse the process to understand encoded messages.
Tips for Creating Strong Ciphers
 Avoid simple patterns: Random substitutions are generally harder to crack than predictable ones like Caesar ciphers.
 Use long keys: The longer and more complex the key, the more secure your cipher.
 Change your keys frequently: Regularly changing the key can help keep your encoded messages secure.
Summary
Using a substitution cipher is a fun and straightforward way to encode messages. By substituting each letter of your message with a different letter or symbol according to a predefined key, you can create a secret code that others can only decode if they know the key. Experiment with different types of ciphers to find the one that best suits your needs for secrecy and fun!