Implementation of transposition(railfence) cipher technique.
Concept: this way to encrypt data is used by trans-positioning data in rows.
For example: we have a plaintext CTUniversity and key is 3 then encryption will accur like this:-
C                                      I                                       S
          T                  N                 V                 R                  I                   Y
                    U                                     E                                      T        
And cipher text will written as- CISTNVRIYUET
C++ program:
#include<iostream>
#include<string.h>
#include<string>
using namespace std;
int main()
{
    int i,len,j=0,k=0;
    char plain[15],cip[15],str1[10],str2[10];
    cout<<"Enter Plain Text:";
    cin>>plain;
    cout<<endl;
    len=strlen(plain);
    for(i=0;i<len;i++)
    {
        if(i%2==0)
        {
            str1[j]=plain[i];
            j++;
        }
        else
            {
                str2[k]=plain[i];
                k++;
            }
        }
    j=0;
    cout<<"Str1:"<<str1<<endl<<"Str2:"<<str2;
}
Demo: I will perform a live web demo for railfence cipher.
|  | 
·       Enter your plaintext
·       Give key for encryption 
·       Press encrypt button 
·       Output will be shown below in a box
Tools:
·       Railfence cipher in c or c++ language coding
 Resources:
·      https://stackoverflow.com/questions/22573871/rail-fence-cipher-algorithm-c  algorithem in c language
 


 
 
 
 
 
 
 
 
 
 
No comments:
Post a Comment