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

  1. Attach All Binary in One Line And Divide in 6 Part
  2. 0100000101110000011100000110110001100101
  3. Dividing Among 6 Parts
  4. 010000 -1st
  5. 010111 -2nd
  6. 000001 -3rd
  7. 110000 -4th
  8. 011011 -5th
  9. 000110 -6th
  10. 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”

suhailroushan.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Deploying a Laravel 5.8 Web App on Ubuntu

YouTube Video | Mobile-First Website with CSS Grid -3

Jupyter on AWS Introduction

jupyter lab tabs

Collections and Primitive Obsession

How SimilarWeb moved to Amazon DynamoDB from Couchbase and saved 70%

How to learn Golang

Don’t Fear The Test: A Beginner Guide to Mock and Stub

Tech: Cool TypeScript Operators You Might Not Know

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Suhail Roushan

Suhail Roushan

suhailroushan.com

More from Medium

Weekly Development Update Nov 29-Dec 3

Originally written in Chinese on 3/20/2021 by Jamie Chiahui Gao

Launching nodelogs.link

INTRODUCING TELOS BLOCKCHAIN — KEY FEATURES AND TOKENOMICS