SlideShare a Scribd company logo
1 of 12
Download to read offline
Solutions to Assignment #1

              ECE 6106
        Computer NW Security



         By: Khalid El-Darymli
        Matric. No.: G0327887




               ECE Dept.
         Faculty of Engineering
          URL: eng.iiu.edu.my

International Islamic University Malaysia
a- Plain Text: “engineering excellence”
 Encryption using Caesar’s cipher: HQJLQHHULQJ HAFHOOHQFH




b- Program for problem # 1:

//Program for problem# 1:
#include<iostream.h>
#include<string.h>
#include<stdio.h>
#define w 10000
#include<conio.h>
char b[w];
int chick(void);
void main()
{
void encrypt(void), decrypt(void);
char op;

cout<<quot;THIS PROGRAM CALCULATING THE ENCRYPTION OR DECRYPTION OF ENTERED
STRINGquot;;
cout<<quot; USING CAESAR's MOEHOD quot;<<endl;
cout<<quot;|**********************************************************************|quot;<<endl;
cout<<quot;Please Choose your CHOICEquot;<<endl;
cout<<quot;To ENCRYPT PLEASE PREES E >>>>quot;<<endl;
cout<<quot;To DECRYPT PLEASE PRESS D >>>quot;<<endl;
cout<<quot;TO EXIT PLEASE PRESS any other keyquot;<<endl;
cin>>op;
clrscr();
switch(op)
{
case 'e':case 'E': encrypt();break;
case 'd': case 'D': decrypt();break;
default: break;
}

}



/*THE FUNCTION OF ENCRYPTION            */
void encrypt()
{
int i,s;
char *p,c[w],n;
cout<<quot;please enter the text to be encrypt:quot;<<endl;
aa:
gets(b);

if(chick()==1)
{cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER the Ciphered text should be
alphabetic text quot;<<endl;
goto aa;}
for(i=0;i<=strlen(b);i++)
{
s=0;
p=&b[i];
if(*p==32||*p=='0')
{s=1;n=32;}
if(*p>=97&&*p<=119)
{s=1,n=*p%97+68;}
if(*p>=120&&*p<=122)
{s=1,n=*p%120+65;}
if(*p>=65&&*p<=87)
{s=1,n=*p+3;}
if(*p>=88&&*p<=90)
{s=1,n=*p%88+65;}
c[i]=n;
if(s==0)
{cout<<quot;YOU ENTERED NON-ALPHABETIC SYMBOL, ALL ENTERS SHOULD BE ALPHABETIC
LETTERSquot;<<endl;
goto xx;}
 }
for(i=0;i<=strlen(b);i++)
cout<<c[i];
xx:
}
//THE FUNCTION OF MAKING DECRYPTION
void decrypt()
{
int i,s;
char *p,c[w],n;
cout<<quot;enter the text to be decryptquot;<<endl;
aa:
gets(b);
if(chick()==1)
{cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER the Ciphered text should be
alphabetic text quot;<<endl;
goto aa;}
for(i=0;i<=strlen(b);i++)
{
s=0;
p=&b[i];
if(*p==32||*p=='0')
{s=1;n=32;}
if(*p>=100&&*p<=122)
{s=1,n=*p-3;}
if(*p>=97&&*p<=99)
{s=1,n=120-*p%97;}
if(*p>=68&&*p<=90)
{s=1,n=*p%68+97;}
if(*p>=65&&*p<=67)
{s=1,n=120-*p%65;}
c[i]=n;
if(s==0)
{cout<<quot;YOU ENTERED NON-ALPHABETIC SYMBOL, ALL ENTERS SHOULD BE ALPHABETIC
LETTERSquot;<<endl;
goto xx;}
 }
for(i=0;i<=strlen(b);i++)
cout<<c[i];
xx:
}

//Function chick, this function chicks the input data to make sure THAT they are
//pure alphabetics WITH OR WITHOUT SPACES
        int chick(void)
        { int test,i;
                        for(i=0;i<strlen(b);i++)
        if((b[i]>=65&&b[i]<=90)||(b[i]>=97&&b[i]<=122)||(b[i]==32))
        test=0;
        else
        {
        test=1;
        return test;
}
return test;
}
3-Program for problem # 3:
//Program for problem# 3:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream.h>
#include<conio.h>
#include<ctype.h>
#define w 10000
char pt[w],kt[w],ct[w],ch[w];
char vignere_table_cipher(char,char);
char vignere_table_decipher(char,char);
 int chick(void);
void main(){
char op;
void cipher(void);
void decipher(void);

cout<<quot;THIS PROGRAM PERFORMS ENCRYPTION OR DECRYPTION FOR ENTERED TEXT
usingquot;;
cout<<quot;Vigenere's autokey cipherquot;<<endl<<endl;
cout<<quot;|**********************************************************************|quot;<<endl;
cout<<quot;Please Choose your CHOICEquot;<<endl;
cout<<quot;[E] For ENCRYPTION please <<Press E followed by enter quot;<<endl;
cout<<quot;[D] For DECRYPTION please <<PRESS D followed by enterquot;<<endl;
cout<<quot; For EXIT please press any other key followed by enterquot;<<endl;
cin>>op;
switch(op)
{
case 'e': case 'E':cipher();break;
case 'd': case 'D':decipher();break;
default: break;
}}
//Ciphering function: This function performs encryption
void cipher(void)
{
int x,n,i;
char mkt[w],ct[w];
char *pp,*kp;
clrscr();
cout<<quot;Enter the text to be Encrypt:>>PLEASE REMOVE SPACES:quot;<<endl;
aa:
gets(pt);
strcpy(ch,pt);
if(chick()==1)
{cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER just alphabetic text without
spacesquot;<<endl;
goto aa;}
cout<<quot;Enter the Encryption key:>>PLEASE REMOVE THE SPACES:quot;<<endl;
strcpy(ch,quot; quot;);
bb:
gets(kt);
strcpy(ch,kt);
if(chick()==1)
{cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER just alphabetic text without
spacesquot;<<endl;
goto bb;}
 for (i=0; i<strlen(pt); i++)
          pt[i] = tolower(pt[i]);
         for(i=0;i<strlen(kt);i++)
         kt[i]=tolower(kt[i]);

 //Making the length of key equal to the length of plain text
x=strlen(pt);
xx:
x-=strlen(kt);
if(x>=0)
{n=strlen(kt);
strncat(mkt,kt,n);
goto xx; }
else
strncat(mkt,kt,x+strlen(kt));
// end of process

//Ciphering and printing of the plaintext
 for(i=0;i<strlen(pt);i++)
 {
 pp=&pt[i];
 kp=&mkt[i];
ct[i]=vignere_table_cipher(*pp,*kp);
 }
printf(quot;nquot;);
for(i=0;i<strlen(ct);i++)
ct[i]=toupper(ct[i]);
 puts(ct);

 }
//End of process

//This function calculating the character corresponding to that we obtain fro Vignere Table
//for two submitted character, the key character and the plain text text character
//the function returns the ciphered character
char vignere_table_cipher(char k,char p)
{
char c;
int d,comp;
comp=k-'a';
d=p+comp;
if(d>122)
{d%=122;
d+=96;}
c=d;
return c;
}

 //Function decipher, this function perofoms decryption.
void decipher(void)
{
 int x,n,i;
char mkt[w],dt[w];
char *pp,*kp,rvv;
clrscr();
cout<<quot;Enter the text to be DECRYPT:>>PLEASE remove the spaces>>quot;<<endl;
aa:
gets(ct);
strcpy(ch,ct);
if(chick()==1)
{cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER the Ciphered text just alphabetic
text without spacesquot;<<endl;
goto aa;}
strcpy(ch,quot; quot;);
cout<<quot;Enter the DECRYPTION key:>>PLEASE REMOVE THE SPACES>>quot;<<endl;
bb:
gets(kt);
 strcpy(ch,kt);
if(chick()==1)
{cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER the KEY just as alphabetic text
without spacesquot;<<endl;
goto bb;}
for (i=0; i<strlen(ct); i++)
                  ct[i] = tolower(ct[i]);
        for(i=0;i<strlen(kt);i++)
        kt[i]=tolower(kt[i]);

         //Making the length of key equal to the length of cipheered text
x=strlen(ct);
xx:
x-=strlen(kt);
if(x>=0)
{n=strlen(kt);
strncat(mkt,kt,n);
goto xx; }
else
strncat(mkt,kt,x+strlen(kt));
// end of process

//deCiphering and printing of the plaintext
 for(i=0;i<strlen(ct);i++)
 {
 pp=&ct[i];
 kp=&mkt[i];
dt[i]=vignere_table_decipher(*kp,*pp);
 }
printf(quot;nquot;);
 puts(dt);
 }
//End of process

//This function calculating the character corresponding to that we obtain from Vignere Table
//for two submitted character, the key character and the ciphered text character
 //the function returns the plain text character
char vignere_table_decipher(char kt,char ct)
 {
char d;
int comp,pt;
comp=kt-'a';
pt=ct-comp;
if(pt<97)
pt+=123-97;
d=pt;
return d;
}
//End of function



//Function chick, this function chicks the input data to make sure they are
//pure alphabetics and without spaces
        int chick(void)
        { int test,i;
                        for(i=0;i<strlen(ch);i++)
        if((ch[i]>=65&&ch[i]<=90)||(ch[i]>=97&&ch[i]<=122))
        test=0;
        else
{
        test=1;
        return test;
}
return test;
}




2-
a- Plain Text: “Engineering Excellence”
         Key: “Kulliyyah”

Encryption Using Playfair: FEMLEFMOMYMFIMGKKGMDE




Note: Sorry, this program not ready yet. It’s just admits the entered key text and mixes it with
the alphabets then it forms 5X5 matrix.



#include<stdio.h>
#include<string.h>
#include<iostream.h>
#include<stdlib.h>
#include<ctype.h>
#define w 999
void distributing_of_array(void);
void remove_of_repetation(void);
void removing_of_i_or_j(void);
void converting_to_5_by_5_matrix(void);
int chick(void);

char kt[w],ktd[w],mktd[w],matrix[5][5],ch[w];
main()
{
cout<<quot;Enter the Encryption key:>>PLEASE REMOVE THE SPACES:quot;<<endl;
  strcpy(ch,quot; quot;);
bb:
gets(kt);
strcpy(ch,kt);
if(chick()==1)
{cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER just alphabetic key text without
spacesquot;<<endl;
goto bb;}



distributing_of_array();
puts(mktd);
removing_of_i_or_j();
converting_to_5_by_5_matrix();

}

void distributing_of_array()
{ int i;
char a[26];
//to ensure all enters are lower case letters
         for(i=0;i<strlen(kt);i++)
         kt[i]=tolower(kt[i]);

strcat(ktd,kt);

for(i=0;i<26;i++)
a[i]='a'+i;



strcat(ktd,a);

remove_of_repetation();



}




void remove_of_repetation(void)
                  {
        mktd[0]=ktd[0];
        int i,j,k=0,u,s=0;

            for(i=1;i<strlen(ktd);i++)
            {
                            s=0;
            for(j=0;j<k+1;j++)
                     if(ktd[i]==mktd[j])
                     s=1;
                                     if(s==0)
mktd[++k]=ktd[i];
                               }

                 }




               void removing_of_i_or_j(void)
               {
               int p1,p2,i,p;
               p1=0;
               p2=0;



                 for(i=0;i<strlen(mktd);i++)
                 {
                 if(mktd[i]=='i')
                 p1=i+1;
                 if(mktd[i]=='j')
                 p2=i+1;
                 }
                if((p1!=0)&&(p2!=0))
                {
                if(p1>p2)
       mktd[p1-1]='j';
       if(p2>p1)
       mktd[p2-1]='i';}

                for(i=0;i<26;i++)
                ktd[i]=mktd[i];

                remove_of_repetation();



       }

         //THIS FUNCTION COMBINE THE KEY TEXT WITH THE ALPHABETICS.
         //NOTE if you entered key text contains 'i' then the letter 'j' won't appear
         //and vica versa
  //again if you entered text contins i and j appeared respictively then j will be removed and vica
versa
 void converting_to_5_by_5_matrix(void)
 {
 int i,j,m=-1;
 for(i=0;i<5;i++)
for(j=0;j<5;j++)
matrix[i][j]=mktd[++m];

for(i=0;i<5;i++)
{printf(quot;nquot;);
for(j=0;j<5;j++)

printf(quot;%cquot;,matrix[i][j]);
 }

 }



  //Function chick, this function chicks the input data to make sure they are
//pure alphabetics and without spaces
        int chick(void)
        { int test,i;
                        for(i=0;i<strlen(ch);i++)
        if((ch[i]>=65&&ch[i]<=90)||(ch[i]>=97&&ch[i]<=122))
        test=0;
        else
        {
        test=1;
        return test;
}
return test;
}

More Related Content

What's hot

Oops lab manual2
Oops lab manual2Oops lab manual2
Oops lab manual2Mouna Guru
 
Matlab assignment
Matlab assignmentMatlab assignment
Matlab assignmentRutvik
 
Nonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programmingNonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programmingSalar Delavar Qashqai
 
Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...Salar Delavar Qashqai
 
Bartosz Milewski, “Re-discovering Monads in C++”
Bartosz Milewski, “Re-discovering Monads in C++”Bartosz Milewski, “Re-discovering Monads in C++”
Bartosz Milewski, “Re-discovering Monads in C++”Platonov Sergey
 
Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”Platonov Sergey
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Aman Deep
 
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Salar Delavar Qashqai
 
Introduction to Homomorphic Encryption
Introduction to Homomorphic EncryptionIntroduction to Homomorphic Encryption
Introduction to Homomorphic EncryptionChristoph Matthies
 
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Salar Delavar Qashqai
 

What's hot (19)

Oops lab manual2
Oops lab manual2Oops lab manual2
Oops lab manual2
 
Arrays
ArraysArrays
Arrays
 
Matlab assignment
Matlab assignmentMatlab assignment
Matlab assignment
 
Nonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programmingNonlinear analysis of braced frame with hinge by hinge method in c programming
Nonlinear analysis of braced frame with hinge by hinge method in c programming
 
Monad
MonadMonad
Monad
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...Geometric nonlinearity analysis of springs with rigid element displacement co...
Geometric nonlinearity analysis of springs with rigid element displacement co...
 
Bartosz Milewski, “Re-discovering Monads in C++”
Bartosz Milewski, “Re-discovering Monads in C++”Bartosz Milewski, “Re-discovering Monads in C++”
Bartosz Milewski, “Re-discovering Monads in C++”
 
PRACTICAL COMPUTING
PRACTICAL COMPUTINGPRACTICAL COMPUTING
PRACTICAL COMPUTING
 
Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”Rainer Grimm, “Functional Programming in C++11”
Rainer Grimm, “Functional Programming in C++11”
 
C++ TUTORIAL 2
C++ TUTORIAL 2C++ TUTORIAL 2
C++ TUTORIAL 2
 
Bijender (1)
Bijender (1)Bijender (1)
Bijender (1)
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
 
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...Geometric and material nonlinearity analysis of 2 d truss with force and duct...
Geometric and material nonlinearity analysis of 2 d truss with force and duct...
 
Introduction to Homomorphic Encryption
Introduction to Homomorphic EncryptionIntroduction to Homomorphic Encryption
Introduction to Homomorphic Encryption
 
Implementing stack
Implementing stackImplementing stack
Implementing stack
 
Oopppp
OoppppOopppp
Oopppp
 
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
Nonlinear analysis of fixed support beam with hinge by hinge method in c prog...
 
Computing on Encrypted Data
Computing on Encrypted DataComputing on Encrypted Data
Computing on Encrypted Data
 

Viewers also liked

ApresentaçãO1sapatosujos
ApresentaçãO1sapatosujosApresentaçãO1sapatosujos
ApresentaçãO1sapatosujoscefaprotga
 
Common Sense Design - MAS.671
Common Sense Design - MAS.671Common Sense Design - MAS.671
Common Sense Design - MAS.671sbisker
 
Memorias De Un Feo
Memorias De Un FeoMemorias De Un Feo
Memorias De Un FeoDonPochin
 
PocketWatchit - MAS.671
PocketWatchit - MAS.671PocketWatchit - MAS.671
PocketWatchit - MAS.671sbisker
 

Viewers also liked (6)

ApresentaçãO1sapatosujos
ApresentaçãO1sapatosujosApresentaçãO1sapatosujos
ApresentaçãO1sapatosujos
 
Common Sense Design - MAS.671
Common Sense Design - MAS.671Common Sense Design - MAS.671
Common Sense Design - MAS.671
 
Meiosis
MeiosisMeiosis
Meiosis
 
Memorias De Un Feo
Memorias De Un FeoMemorias De Un Feo
Memorias De Un Feo
 
PocketWatchit - MAS.671
PocketWatchit - MAS.671PocketWatchit - MAS.671
PocketWatchit - MAS.671
 
Web2keynote
Web2keynoteWeb2keynote
Web2keynote
 

Similar to Microsoft Word Hw#1

include.docx
include.docxinclude.docx
include.docxNhiPtaa
 
Sparse Matrix and Polynomial
Sparse Matrix and PolynomialSparse Matrix and Polynomial
Sparse Matrix and PolynomialAroosa Rajput
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxssuser3cbb4c
 
include ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdfinclude ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdfcontact32
 
Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for SpeedYung-Yu Chen
 
C Code and the Art of Obfuscation
C Code and the Art of ObfuscationC Code and the Art of Obfuscation
C Code and the Art of Obfuscationguest9006ab
 
I have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfI have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfshreeaadithyaacellso
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresLakshmi Sarvani Videla
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020vrgokila
 
Sorting programs
Sorting programsSorting programs
Sorting programsVarun Garg
 

Similar to Microsoft Word Hw#1 (20)

C# Assignmet Help
C# Assignmet HelpC# Assignmet Help
C# Assignmet Help
 
include.docx
include.docxinclude.docx
include.docx
 
C program
C programC program
C program
 
Implementing string
Implementing stringImplementing string
Implementing string
 
Sparse Matrix and Polynomial
Sparse Matrix and PolynomialSparse Matrix and Polynomial
Sparse Matrix and Polynomial
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptx
 
Cpp programs
Cpp programsCpp programs
Cpp programs
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
include ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdfinclude ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdf
 
Write Python for Speed
Write Python for SpeedWrite Python for Speed
Write Python for Speed
 
oodp elab.pdf
oodp elab.pdfoodp elab.pdf
oodp elab.pdf
 
C Code and the Art of Obfuscation
C Code and the Art of ObfuscationC Code and the Art of Obfuscation
C Code and the Art of Obfuscation
 
I have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfI have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdf
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
 
Vcs16
Vcs16Vcs16
Vcs16
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
 
Blocks+gcd入門
Blocks+gcd入門Blocks+gcd入門
Blocks+gcd入門
 
Stl algorithm-Basic types
Stl algorithm-Basic typesStl algorithm-Basic types
Stl algorithm-Basic types
 
C programs
C programsC programs
C programs
 
Sorting programs
Sorting programsSorting programs
Sorting programs
 

More from kkkseld

H E A D S C A R F D E A D L O C K I N T U R K E Y A S A C A S E S T U D Y
H E A D S C A R F  D E A D L O C K  I N  T U R K E Y  A S  A  C A S E  S T U D YH E A D S C A R F  D E A D L O C K  I N  T U R K E Y  A S  A  C A S E  S T U D Y
H E A D S C A R F D E A D L O C K I N T U R K E Y A S A C A S E S T U D Ykkkseld
 
Microsoft Word Mobile Multi Media Applications
Microsoft Word   Mobile Multi Media ApplicationsMicrosoft Word   Mobile Multi Media Applications
Microsoft Word Mobile Multi Media Applicationskkkseld
 
Microsoft Word Project, Firewalls
Microsoft Word   Project, FirewallsMicrosoft Word   Project, Firewalls
Microsoft Word Project, Firewallskkkseld
 
Microsoft Word Hw#2
Microsoft Word   Hw#2Microsoft Word   Hw#2
Microsoft Word Hw#2kkkseld
 
Microsoft Word Hw#3
Microsoft Word   Hw#3Microsoft Word   Hw#3
Microsoft Word Hw#3kkkseld
 
Microsoft Word The Project, Islam And Science
Microsoft Word   The Project, Islam And ScienceMicrosoft Word   The Project, Islam And Science
Microsoft Word The Project, Islam And Sciencekkkseld
 
Speech To Sign Language Interpreter System
Speech To Sign Language Interpreter SystemSpeech To Sign Language Interpreter System
Speech To Sign Language Interpreter Systemkkkseld
 
Presentation, Firewalls
Presentation, FirewallsPresentation, Firewalls
Presentation, Firewallskkkseld
 
Mobile Multi Media Applications
Mobile Multi Media ApplicationsMobile Multi Media Applications
Mobile Multi Media Applicationskkkseld
 
Presentation, Firewalls
Presentation, FirewallsPresentation, Firewalls
Presentation, Firewallskkkseld
 
Kerie2006 Poster Template 01
Kerie2006 Poster Template 01Kerie2006 Poster Template 01
Kerie2006 Poster Template 01kkkseld
 

More from kkkseld (14)

H E A D S C A R F D E A D L O C K I N T U R K E Y A S A C A S E S T U D Y
H E A D S C A R F  D E A D L O C K  I N  T U R K E Y  A S  A  C A S E  S T U D YH E A D S C A R F  D E A D L O C K  I N  T U R K E Y  A S  A  C A S E  S T U D Y
H E A D S C A R F D E A D L O C K I N T U R K E Y A S A C A S E S T U D Y
 
Microsoft Word Mobile Multi Media Applications
Microsoft Word   Mobile Multi Media ApplicationsMicrosoft Word   Mobile Multi Media Applications
Microsoft Word Mobile Multi Media Applications
 
Microsoft Word Project, Firewalls
Microsoft Word   Project, FirewallsMicrosoft Word   Project, Firewalls
Microsoft Word Project, Firewalls
 
Microsoft Word Hw#2
Microsoft Word   Hw#2Microsoft Word   Hw#2
Microsoft Word Hw#2
 
Microsoft Word Hw#3
Microsoft Word   Hw#3Microsoft Word   Hw#3
Microsoft Word Hw#3
 
Asr
AsrAsr
Asr
 
Microsoft Word The Project, Islam And Science
Microsoft Word   The Project, Islam And ScienceMicrosoft Word   The Project, Islam And Science
Microsoft Word The Project, Islam And Science
 
Speech To Sign Language Interpreter System
Speech To Sign Language Interpreter SystemSpeech To Sign Language Interpreter System
Speech To Sign Language Interpreter System
 
Presentation, Firewalls
Presentation, FirewallsPresentation, Firewalls
Presentation, Firewalls
 
Sslis
SslisSslis
Sslis
 
Mobile Multi Media Applications
Mobile Multi Media ApplicationsMobile Multi Media Applications
Mobile Multi Media Applications
 
Presentation, Firewalls
Presentation, FirewallsPresentation, Firewalls
Presentation, Firewalls
 
Kerie2006 Poster Template 01
Kerie2006 Poster Template 01Kerie2006 Poster Template 01
Kerie2006 Poster Template 01
 
Asr
AsrAsr
Asr
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Microsoft Word Hw#1

  • 1. Solutions to Assignment #1 ECE 6106 Computer NW Security By: Khalid El-Darymli Matric. No.: G0327887 ECE Dept. Faculty of Engineering URL: eng.iiu.edu.my International Islamic University Malaysia
  • 2. a- Plain Text: “engineering excellence” Encryption using Caesar’s cipher: HQJLQHHULQJ HAFHOOHQFH b- Program for problem # 1: //Program for problem# 1: #include<iostream.h> #include<string.h> #include<stdio.h> #define w 10000 #include<conio.h> char b[w]; int chick(void); void main() { void encrypt(void), decrypt(void); char op; cout<<quot;THIS PROGRAM CALCULATING THE ENCRYPTION OR DECRYPTION OF ENTERED STRINGquot;; cout<<quot; USING CAESAR's MOEHOD quot;<<endl; cout<<quot;|**********************************************************************|quot;<<endl; cout<<quot;Please Choose your CHOICEquot;<<endl; cout<<quot;To ENCRYPT PLEASE PREES E >>>>quot;<<endl; cout<<quot;To DECRYPT PLEASE PRESS D >>>quot;<<endl; cout<<quot;TO EXIT PLEASE PRESS any other keyquot;<<endl; cin>>op; clrscr(); switch(op) { case 'e':case 'E': encrypt();break; case 'd': case 'D': decrypt();break; default: break; } } /*THE FUNCTION OF ENCRYPTION */ void encrypt()
  • 3. { int i,s; char *p,c[w],n; cout<<quot;please enter the text to be encrypt:quot;<<endl; aa: gets(b); if(chick()==1) {cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER the Ciphered text should be alphabetic text quot;<<endl; goto aa;} for(i=0;i<=strlen(b);i++) { s=0; p=&b[i]; if(*p==32||*p=='0') {s=1;n=32;} if(*p>=97&&*p<=119) {s=1,n=*p%97+68;} if(*p>=120&&*p<=122) {s=1,n=*p%120+65;} if(*p>=65&&*p<=87) {s=1,n=*p+3;} if(*p>=88&&*p<=90) {s=1,n=*p%88+65;} c[i]=n; if(s==0) {cout<<quot;YOU ENTERED NON-ALPHABETIC SYMBOL, ALL ENTERS SHOULD BE ALPHABETIC LETTERSquot;<<endl; goto xx;} } for(i=0;i<=strlen(b);i++) cout<<c[i]; xx: } //THE FUNCTION OF MAKING DECRYPTION void decrypt() { int i,s; char *p,c[w],n; cout<<quot;enter the text to be decryptquot;<<endl; aa: gets(b); if(chick()==1) {cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER the Ciphered text should be alphabetic text quot;<<endl;
  • 4. goto aa;} for(i=0;i<=strlen(b);i++) { s=0; p=&b[i]; if(*p==32||*p=='0') {s=1;n=32;} if(*p>=100&&*p<=122) {s=1,n=*p-3;} if(*p>=97&&*p<=99) {s=1,n=120-*p%97;} if(*p>=68&&*p<=90) {s=1,n=*p%68+97;} if(*p>=65&&*p<=67) {s=1,n=120-*p%65;} c[i]=n; if(s==0) {cout<<quot;YOU ENTERED NON-ALPHABETIC SYMBOL, ALL ENTERS SHOULD BE ALPHABETIC LETTERSquot;<<endl; goto xx;} } for(i=0;i<=strlen(b);i++) cout<<c[i]; xx: } //Function chick, this function chicks the input data to make sure THAT they are //pure alphabetics WITH OR WITHOUT SPACES int chick(void) { int test,i; for(i=0;i<strlen(b);i++) if((b[i]>=65&&b[i]<=90)||(b[i]>=97&&b[i]<=122)||(b[i]==32)) test=0; else { test=1; return test; } return test; }
  • 5. 3-Program for problem # 3: //Program for problem# 3: #include<stdio.h> #include<stdlib.h> #include<string.h> #include<iostream.h> #include<conio.h> #include<ctype.h> #define w 10000 char pt[w],kt[w],ct[w],ch[w]; char vignere_table_cipher(char,char); char vignere_table_decipher(char,char); int chick(void); void main(){ char op; void cipher(void); void decipher(void); cout<<quot;THIS PROGRAM PERFORMS ENCRYPTION OR DECRYPTION FOR ENTERED TEXT usingquot;; cout<<quot;Vigenere's autokey cipherquot;<<endl<<endl; cout<<quot;|**********************************************************************|quot;<<endl; cout<<quot;Please Choose your CHOICEquot;<<endl; cout<<quot;[E] For ENCRYPTION please <<Press E followed by enter quot;<<endl; cout<<quot;[D] For DECRYPTION please <<PRESS D followed by enterquot;<<endl; cout<<quot; For EXIT please press any other key followed by enterquot;<<endl; cin>>op; switch(op) { case 'e': case 'E':cipher();break; case 'd': case 'D':decipher();break; default: break; }} //Ciphering function: This function performs encryption void cipher(void) { int x,n,i; char mkt[w],ct[w]; char *pp,*kp; clrscr(); cout<<quot;Enter the text to be Encrypt:>>PLEASE REMOVE SPACES:quot;<<endl; aa: gets(pt); strcpy(ch,pt); if(chick()==1)
  • 6. {cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER just alphabetic text without spacesquot;<<endl; goto aa;} cout<<quot;Enter the Encryption key:>>PLEASE REMOVE THE SPACES:quot;<<endl; strcpy(ch,quot; quot;); bb: gets(kt); strcpy(ch,kt); if(chick()==1) {cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER just alphabetic text without spacesquot;<<endl; goto bb;} for (i=0; i<strlen(pt); i++) pt[i] = tolower(pt[i]); for(i=0;i<strlen(kt);i++) kt[i]=tolower(kt[i]); //Making the length of key equal to the length of plain text x=strlen(pt); xx: x-=strlen(kt); if(x>=0) {n=strlen(kt); strncat(mkt,kt,n); goto xx; } else strncat(mkt,kt,x+strlen(kt)); // end of process //Ciphering and printing of the plaintext for(i=0;i<strlen(pt);i++) { pp=&pt[i]; kp=&mkt[i]; ct[i]=vignere_table_cipher(*pp,*kp); } printf(quot;nquot;); for(i=0;i<strlen(ct);i++) ct[i]=toupper(ct[i]); puts(ct); } //End of process //This function calculating the character corresponding to that we obtain fro Vignere Table //for two submitted character, the key character and the plain text text character
  • 7. //the function returns the ciphered character char vignere_table_cipher(char k,char p) { char c; int d,comp; comp=k-'a'; d=p+comp; if(d>122) {d%=122; d+=96;} c=d; return c; } //Function decipher, this function perofoms decryption. void decipher(void) { int x,n,i; char mkt[w],dt[w]; char *pp,*kp,rvv; clrscr(); cout<<quot;Enter the text to be DECRYPT:>>PLEASE remove the spaces>>quot;<<endl; aa: gets(ct); strcpy(ch,ct); if(chick()==1) {cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER the Ciphered text just alphabetic text without spacesquot;<<endl; goto aa;} strcpy(ch,quot; quot;); cout<<quot;Enter the DECRYPTION key:>>PLEASE REMOVE THE SPACES>>quot;<<endl; bb: gets(kt); strcpy(ch,kt); if(chick()==1) {cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER the KEY just as alphabetic text without spacesquot;<<endl; goto bb;} for (i=0; i<strlen(ct); i++) ct[i] = tolower(ct[i]); for(i=0;i<strlen(kt);i++) kt[i]=tolower(kt[i]); //Making the length of key equal to the length of cipheered text x=strlen(ct); xx:
  • 8. x-=strlen(kt); if(x>=0) {n=strlen(kt); strncat(mkt,kt,n); goto xx; } else strncat(mkt,kt,x+strlen(kt)); // end of process //deCiphering and printing of the plaintext for(i=0;i<strlen(ct);i++) { pp=&ct[i]; kp=&mkt[i]; dt[i]=vignere_table_decipher(*kp,*pp); } printf(quot;nquot;); puts(dt); } //End of process //This function calculating the character corresponding to that we obtain from Vignere Table //for two submitted character, the key character and the ciphered text character //the function returns the plain text character char vignere_table_decipher(char kt,char ct) { char d; int comp,pt; comp=kt-'a'; pt=ct-comp; if(pt<97) pt+=123-97; d=pt; return d; } //End of function //Function chick, this function chicks the input data to make sure they are //pure alphabetics and without spaces int chick(void) { int test,i; for(i=0;i<strlen(ch);i++) if((ch[i]>=65&&ch[i]<=90)||(ch[i]>=97&&ch[i]<=122)) test=0; else
  • 9. { test=1; return test; } return test; } 2- a- Plain Text: “Engineering Excellence” Key: “Kulliyyah” Encryption Using Playfair: FEMLEFMOMYMFIMGKKGMDE Note: Sorry, this program not ready yet. It’s just admits the entered key text and mixes it with the alphabets then it forms 5X5 matrix. #include<stdio.h> #include<string.h> #include<iostream.h> #include<stdlib.h> #include<ctype.h> #define w 999 void distributing_of_array(void); void remove_of_repetation(void); void removing_of_i_or_j(void); void converting_to_5_by_5_matrix(void); int chick(void); char kt[w],ktd[w],mktd[w],matrix[5][5],ch[w]; main() { cout<<quot;Enter the Encryption key:>>PLEASE REMOVE THE SPACES:quot;<<endl; strcpy(ch,quot; quot;); bb: gets(kt); strcpy(ch,kt); if(chick()==1) {cout<<quot;SORRY,ERROR IN THE INPUT DATA>>please RENTER just alphabetic key text without spacesquot;<<endl;
  • 10. goto bb;} distributing_of_array(); puts(mktd); removing_of_i_or_j(); converting_to_5_by_5_matrix(); } void distributing_of_array() { int i; char a[26]; //to ensure all enters are lower case letters for(i=0;i<strlen(kt);i++) kt[i]=tolower(kt[i]); strcat(ktd,kt); for(i=0;i<26;i++) a[i]='a'+i; strcat(ktd,a); remove_of_repetation(); } void remove_of_repetation(void) { mktd[0]=ktd[0]; int i,j,k=0,u,s=0; for(i=1;i<strlen(ktd);i++) { s=0; for(j=0;j<k+1;j++) if(ktd[i]==mktd[j]) s=1; if(s==0)
  • 11. mktd[++k]=ktd[i]; } } void removing_of_i_or_j(void) { int p1,p2,i,p; p1=0; p2=0; for(i=0;i<strlen(mktd);i++) { if(mktd[i]=='i') p1=i+1; if(mktd[i]=='j') p2=i+1; } if((p1!=0)&&(p2!=0)) { if(p1>p2) mktd[p1-1]='j'; if(p2>p1) mktd[p2-1]='i';} for(i=0;i<26;i++) ktd[i]=mktd[i]; remove_of_repetation(); } //THIS FUNCTION COMBINE THE KEY TEXT WITH THE ALPHABETICS. //NOTE if you entered key text contains 'i' then the letter 'j' won't appear //and vica versa //again if you entered text contins i and j appeared respictively then j will be removed and vica versa void converting_to_5_by_5_matrix(void) { int i,j,m=-1; for(i=0;i<5;i++)
  • 12. for(j=0;j<5;j++) matrix[i][j]=mktd[++m]; for(i=0;i<5;i++) {printf(quot;nquot;); for(j=0;j<5;j++) printf(quot;%cquot;,matrix[i][j]); } } //Function chick, this function chicks the input data to make sure they are //pure alphabetics and without spaces int chick(void) { int test,i; for(i=0;i<strlen(ch);i++) if((ch[i]>=65&&ch[i]<=90)||(ch[i]>=97&&ch[i]<=122)) test=0; else { test=1; return test; } return test; }