Encode Your Messages Using Base64
Encoding
Encoding and decoding are used in many forms of communications, including computing, data communications, programming, digital electronics, and human communications. These two processes involve changing the format of content for optimal transmission or storage.
In computers, encoding is the process of putting a sequence of c characters (letters, numbers, punctuation, and certain symbols) into a specialized format for efficient transmission or storage. Decoding is the opposite process β the conversion of an encoded format back into the original sequence of characters.
These terms should not be confused with encryption and decryption, which focus on hiding and securing data. (We can encrypt data without changing the code or encode data without deliberately concealing the content.)
The Algorithm of base64 Encoding algorithm
Step 1 :
Choose the input string or data
Example: Apple
Step 2 :
Count the number of characters in a String
A ,p,p,l,e
Apple has 5 Characters
Step 3:
Encode the String In ASCII Format
From ASCII Table
A = 65
p = 112
p = 112
l = 108
e = 101
Step 4: Convert the Decimal to Binary in (8 Bit)
A = 65 = 01000001
p = 112 = 01110000
p = 112 = 01110000
l = 108 = 01101100
e = 101 = 01100101
Step 5: Divide the above Binary into chunks of 6-bits
- Attach All Binary in One Line And Divide in 6 Part
- 0100000101110000011100000110110001100101
- Dividing Among 6 Parts
- 010000 -1st
- 010111 -2nd
- 000001 -3rd
- 110000 -4th
- 011011 -5th
- 000110 -6th
- 0101 -7th
Step 6: BASE64 TABLE
Base64 Has 64 Characters
(A β Z) β β β 1β26
(a-z) β β β 26 -51
(0β9) β ββ52β61
(+ /) β β β β 61β63
( = )β β β β β β 64
Step 7: Convert Those 6 parts to Decimal From The Above Table
010000 -> Q is Character and Decimal is 16
010111 -> X is Character and Decimal is 23
000001 -> B is Character and Decimal is 1
110000 -> w is Character and Decimal is 48
011011 -> b is Character and Decimal is 27
000110 -> G is Character and Decimal is 6
0101 -> U is Character and Decimal is 20
Add Padding = If you have to add two zeros 00
For 2 zeros is equal to (=)
Example 0101 Add 2 zeros in last
010100
0101 = βFβ
00 = β=β
010100 = βF =β
Example 2:
String = βTHEβ
In ASCII For (THE)
T is 84
H is 72
E is 69
Converting that decimal into Binary 8 bit
84β01010100
72β01001000
69β01000101
Diving Whole Binary In 6 Bit Chunks
β 84 β β -β 72 β β β69 β β
01010100 01001000 01000101
010101 = V
000100 =E
100001 =h
000101 = F
Base64 of THE is βVEhFβ