Saturday, June 4, 2016

Encoding and Encrypting

Encoding
Encoding is converting one data type to another data type using any method. Why we convert one data type to another type. There are two reasons for this.

1.       To store data.


        We know our computers can store their memory only bits. That means 1 & 0 in binary language. So every data what we store in the computer memory is stored in after converting binary data. Best example is ASCII, Unicode. 

2.       For the transmission of data.


        When transmitting the data from one place to another, data have been encoded because of the safety of data and system. Best example for this transmitting the data through HTTP we encode the data according to the base64 algorithm. Encode the data using this method English letters are changed to numbers and there are special two characters. In the internet every URLs are encoded.
Best advantage of encoding when using data between two systems is these two system can understand the data. Not to be stolen by anybody or the change of data is not expected.
To decode the encoded data using an algorithm, we use famous algorithm to encode data. So if anyone know the algorithm can decode the encoded data.

              Encrypting
Encrypting belongs to cryptography. That means when data are transmitted or stored, the data is changed so that anybody cannot steel them.
Example for Encrypted string ^#s!MF#:5_(A!R5-(X_


These type of encrypted data can’t be understood. 
Encrypted data using this method are called cipher-text. Not encrypted data is called as plain-text.
We use key to encrypt data.
Using this key encrypting methods can divide into two ways.
  •      Symmetric key encryption


In this method a key is used to encrypt the data. If anyone wants decry-pt these data he should use the same key.
  •    Asymmetric Cryptography(public-key cryptography) 



In this method two keys are used and those are public key and private key. Anyone can watch this public key. But private key is confidential. We use public key for data encrypt. One who receive the cipher text use private key to decry-pt. But can’t decry-pt using public key.

Nowadays important web sites use SSL technology. This SSL is Public-key cryptography technology.
This is a small algorithm to encrypt and decry-pt. I use this for Transposition cipher method and python language. 
In Transposition chipper method
We think plaintext is – thisis
Key – mymainkey
First we take the key and remove the characters which come more than once. 
m y a i n k e
According to the length of the key the alphabet is written in sections.  The characters in the key is not written again. 
m y a I n k e
b c d f g h l
o p q r s t u
v w x y z
Now characters are written in the key according to the alphabetical order from the top to the bottom. 
a d q x e l u i  f r y k h t m b o v n g s z  y c  p w 
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
Instead of the characters of the alphabet written below, characters of the upper line can be used to build the cipher-text. 
n m h u h u 

No comments:

Post a Comment