Saturday, September 12, 2015

HTML ASSIGNMENT 1

<html>
<head>
<title>Departmental Store </title>
</head>
<body>

<center>
<table border=2 width=920>
<tr>
<td> <img src=sagarmatha.jpg> </td>
<td>THIS IS DEPARMANTAl STORE FOE ALL</td>
<td> <img src=sagarmatha.jpg> </td>
</tr>
</table>

<table cellpadding=40 width=920>
<tr>
<td>Home </td>
<td> About us </td>
<td>Our service </td>
<td>Contact Us </td>
</tr>
</table>

<table border=2 cellpadding=20 width=920>
<tr>
<td rowspan=2> <img src=sagarmatha.jpg> </td>
<td>
<h2>Welcome to XYZ SuperMarket</h2>
</td>
<td rowspan=2>
<ul>
<li><a href="http://www.paypal.com" </a> PAY Vai Paypal </li>
<li><a href="http://www.visa.com" </a> PAY Vai VISA</li>
</ul>
</td>
</tr>

<tr>
<td rowspan=2> <img src=sagarmatha.jpg> <br> <h2>Description</h2> </td>
</tr>

<tr>
<td><img src=sagarmatha.jpg> </td>
<td><img src=sagarmatha.jpg> </td>
</tr>


</table>
</center>


</body>
</html>

Tuesday, April 21, 2015

Rail fence cipher program in C++

#include<iostream>
#include<string.h>
using namespace std;
class RailFence
{
char plain[55],cipher[55],matrix[9][9];
int pl,kl,i,j,k,l,n,m,temp,key[11];

public:
RailFence(){}
void GetPlain()
{
cout<<endl<<"\t\t ***ENTER PLAIN TEXT***"<<endl;
gets(plain);
pl=strlen(plain);
}

void GetKey()
{
cout<<endl<<"\t\t ***ENTER KEY SIZE***"<<endl;
cin>>kl;
cout<<endl<<"\t\t ***ENTER KEY***"<<endl;

for(i=0;i<kl;i++)
{
cin>>key[i];
}
cout<<"KEY IS::";
for(i=0;i<kl;i++)
{
cout<<"\t"<<key[i];
}
cout<<endl;
}

void PlainManipulation()
{
if(pl%kl!=0)
{
temp=((pl/kl)+1)*kl;
for(j=pl;j<temp;j++)
{
plain[j]='x';
}
plain[temp]='\0';
}
else
{
temp=pl;
}
}

void MakeMatrix()
{
k=0;
cout<<"\t";
for(i=0;i<(temp/kl);i++)
{
for(j=0;j<kl;j++,k++)
{
matrix[i][j]=plain[k];
cout<<"\t"<<matrix[i][j];
}
cout<<endl;
cout<<"\t";
}
}

void Encryption()
{
k=1;
m=0;
for(i=0;i<kl;i++)
{
for(j=0;j<kl;j++)
{
if(key[j]==k)
{
k++;
for(l=0;l<temp/kl;l++)
{
for(n=0;n<kl;n++)
{
if(j==n)
{
cipher[m]=matrix[l][n];
m++;
}
}
}
}
}
}
}

void DisplayCipher()
{
cout<<endl<<"\t\t ***CIPHER TEXT IS***"<<endl<<endl<<"\t\t";
for(i=0;i<temp;i++)
{
cout<<cipher[i];
}
cout<<endl<<endl<<"\t\t ***END***"<<endl<<endl;
}

};

int main()
{
RailFence R1;
R1.GetPlain();
R1.GetKey();
R1.PlainManipulation();
R1.MakeMatrix();
R1.Encryption();
R1.DisplayCipher();

return 0;
}

Thursday, April 9, 2015

Vigenere Cipher C++ code

Code
/*
Vigenere Cipher C++ code
Here we assume that plain text length is equal or  more than key length
*/

#include<iostream>
#include<string.h>

using namespace std;

class VigenereCipher
{
char plain[33],cipher[33],key[11];
int i,j,pl,kl;
public:
VigenereCipher(){ }
void GetPlain()
{
cout<<"\t\t\t ***ENTER PLAIN TEXT***"<<endl;
cin>>plain;
pl=strlen(plain);
}
void GetKey()
{
cout<<endl<<"\t\t\t ***ENTER KEY***"<<endl;
cin>>key;
kl=strlen(key);
}
void KeyManip()
{
for(i=0;i<pl;i++)
{
key[i]=key[i%kl];
}
}
void Encryption()
{
for(i=0;i<pl;i++)
{
cipher[i]=(((plain[i]-97)+(key[i]-97))%26)+97;
}
}
void DisplayCipher()
{
cout<<endl<<"\t\t\t ***CIPHER TEXT IS***"<<endl;
for(j=0;j<pl;j++)
{
cout<<cipher[j];
}
cout<<endl<<endl<<"\t\t\t+++END OF PROGRAM+++";
}
};

int main()
{
VigenereCipher v1;
v1.GetPlain();
v1.GetKey();
v1.KeyManip();
v1.Encryption();
v1.DisplayCipher();
return 0;
}