Tuesday, December 21, 2010

Wednesday, November 17, 2010

TOEFL Links

Hello Friends,
I found some of the important links. These links will helpful for TOEFL. Please check out, it may help u lot. If you found it is good tell others. Else shut your mouth.


http://gotoefl.blogspot.com/

http://www.stuff.co.uk/toefl.htm

http://www.thetoefl.com/

http://www.ets.org/Media/Tests/TOEFL/exe/toeflSample.exe






Saturday, September 25, 2010

GRE Important Link

Hello Friends,
I found some of the important links. These links will helpful for GRE. Please check out, it may help u lot. If you found it is good tell others. Else shut your mouth.


http://gredownloads.blogspot.com/

http://gredownloads.blogspot.com/2008/07/gre-barrons-audio-wordlist-by-profm.html

http://rs13.rapidshare.com/files/101496851/advanced_english_dictionary.rar

http://www.achieverspoint.com/winoverwords.htm

http://www.blogcatalog.com/blog/gre-picture-dictionary

http://www.usingenglish.com/

http://www.enchantedlearning.com/alphabet/matchwordsandpix/

http://www.manythings.org/lulu/

http://allaboutgre.blogspot.com/2006/01/sample-essays.html

http://gre-download.blogspot.com/

http://www.greguide.com

http://www.online-languages.info/_ud2/dictionary.php?l1=english&l2=marathi

http://www.statementofpurpose.com/essay_samples.html

http://www.accesseducationindia.com/gre-engineering-ms.html

http://greghost.blogspot.com/2006/09/free-gre-downloads_05.html

http://grebag.blogspot.com/

http://www.codecoax.com/grerc/

http://www.info-gre.blogspot.com/

http://gre.complore.com/

http://gre.learnhub.com/

Saturday, May 8, 2010

NIS HMAC Implementation

#include
#include
#include

#define SIZE 64

typedef unsigned char uchar ;
int main ( int argc, char * argv[] )
{
FILE * kfp ;
FILE * ifp ;
FILE * ofp ;
FILE * tfp ;
uchar c[2] ;
uchar ch;
uchar key[SIZE] = { 0x00 } ;
uchar ipad[SIZE] ;
uchar opad[SIZE] ;
uchar command[100] ;
int i;

if ( 4 != argc )
{
printf( "Incorrect Usage!\n" ) ;
printf( "Correct Usage is ./hmac " ) ;
}
for ( i = 0; i < SIZE; i++ )
{
ipad[i] = 0x36 ;
opad[i] = 0x5C ;
}


kfp = fopen( argv[1], "r+b" ) ;
ofp = fopen( argv[3], "w+b" ) ;
tfp = fopen( "temp", "w+b" ) ;

fread( key, sizeof( uchar ), SIZE, kfp ) ;
fclose ( kfp );

for ( i = 0; i < SIZE; i++ )
{
key[i] = key[i] ^ ipad[i] ;
}

fwrite( key, sizeof( uchar ), SIZE, tfp ) ;
fclose( tfp ) ;

sprintf( command, "cat %s >> temp", argv[2]) ;
system( command ) ;
system( "./md5 temp > temp1" ) ;

kfp = fopen( argv[1], "r+b" ) ;
fread( key, sizeof( uchar ), SIZE, kfp ) ;
fclose ( kfp );
for ( i = 0; i < SIZE; i++ )
{
key[i] = key[i] ^ opad[i] ;
fwrite( &key[i], sizeof( uchar ), 1, ofp ) ;
}

tfp = fopen( "temp1", "r+b" ) ;
for ( i = 0; i < 16; i++ )
{
fread( c, sizeof( uchar ), 2, tfp );
c[0] -= '0' ;
if ( c[0] > 9 )
{
c[0] = c[0] + '0' - 'a' + 10 ;
}

c[1] -= '0' ;
if ( c[1] > 9 )
{
c[1] = c[1] + '0' - 'a' + 10 ;
}
ch = ( c[0] << 4 ) | c[1] ;
fwrite( &ch, sizeof( uchar ), 1, ofp ) ;
}
fclose( ofp ) ;

sprintf( command, "./md5 %s > temp", argv[3] ) ;
system( command ) ;
system( "cat temp" ) ;
printf( "\n" ) ;

return 0;
}

//OUTPUT:

root@root:~$ ./a.out key.txt hmac.c output.txt
7d1ef72ee877ec646f700288e0693462


Kaeyfile contents:
MHCVGFDC&^$$#@%^MHCVGFDC&^$$#@%^MHCVGFDC&^$$#@%^MHCVGFDC&^$$#@%^

NIS SDES Implementation

#include
#include

typedef unsigned short int uint16 ;
typedef unsigned char uchar;

#define BIT( b, n ) ( ( b >> n ) & 0x01 )

uint16 p10( uint16 );
uint16 p8( uint16 );
uint16 p4( uint16 ) ;
uint16 ip( uint16 );
uint16 ip_inv( uint16 );
uint16 ep( uint16 );
uint16 swap( uint16 );
void print( uint16 );
void genkeys( uint16, uint16*, uint16* );
uint16 encrypt( uint16, uint16, uint16) ;



uint16 S0[4][4] =
{
{ 1, 0, 3, 2 },
{ 3, 2, 1, 0 },
{ 0, 2, 1, 3 },
{ 3, 1, 0, 3 }
};
uint16 S1[4][4] =
{
{ 0, 1, 2, 3 },
{ 2, 0, 1, 3 },
{ 3, 0, 1, 0 },
{ 2, 1, 0, 3 }
};


void dispCorrectUsage()
{
printf( "Incorrect Usage!\n" ) ;
printf( "Correct Usage is:

Program for sum of series

//Program to calculate the sum of series

#include
#include
long int factorial(int n);
void main()
{
int n,i;
float s,r;
char c;
clrscr();
repeat : printf("\nYou have this series:- 1/1! + 2/2! + 3/3! + 4/4! ...");
printf("\n\nTo which term you want its sum? ");
scanf("%d",&n);
s=0;
for (i=1;i<=n;i++)
{ s=s+((float)i/(float)factorial(i)); }
printf("\nThe sum of '[%d]' terms is : %f",n,s);
fflush(stdin);
printf ("\n\nDo you want to continue?(y/n):- ");
scanf("%c",&c);
if (c=='y')
goto repeat;
getch();
}

long int factorial(int n)
{
if (n<=1)
return(1);
else
n=n*factorial(n-1);
return(n);
}

Pyramid of nos

//Pyramid of Numbers

#include
#include

int pyramid( int length )
{
clrscr();
int line = 1;
int j = 1, i, k = length;

while( length-- )
{
if( j == 1 )
{
for( i = 1; i <= length + 5; i++ )
printf( "" );
printf( "%d", j++ );printf("\n");
k--;
line++;
}

else if( i % 2 )
{
for( i = 1; i <= length + 5; i++ )
printf( "" );
for( i = 1; i <= line; i++ )
printf( "%d ", ( j++ % 10 ) );
printf( "\n" );
line++;
k--;
}

else
{
for( i = 1; i <= length + 5 ; i++ )
printf( "" );
for( i = 1; i <= line; i++ )
printf( "%d ", ( j++ % 10 ) );
printf( "\n" );
line++;
k--;
}
}

return 0;
}

int main( )
{
clrscr();
int length;

printf( "Enter the list length" );
scanf( "%d", &length );

pyramid( length );
getch( );
return 0;
}

Polynomial Multiplication

//Polynomial Multiplication

#include
#include
#include

typedef struct poly
{
int coeff,expo;
}P;
P p1[10],p2[10],p3[20]={0};
int t1,t2;

void multiply();

void main()
{
int i,ch;
char cho;
clrscr();

printf("Please enter number of terms in p1: ");
scanf("%d",&t1);
printf("\nPlease enter coeff. & expo of terms in p1\n");
for(i=0;i {
scanf("%d%d",&p1[i].coeff,&p1[i].expo);
}
printf("\n\nPlease enter number of terms in p2: ");
scanf("%d",&t2);
printf("\nPlease enter coeff. & expo of terms in p2\n");
for(i=0;i {
scanf("%d%d",&p2[i].coeff,&p2[i].expo);
}

do
{
clrscr();
printf("First polynomial is\n");
for(i=0;i<(t1-1);i++)
{
printf("(%d x^%d) + ",p1[i].coeff,p1[i].expo);
}
printf("(%d x^%d)",p1[i].coeff,p1[i].expo);
printf("\n\nSecond polynomial is\n");
for(i=0;i<(t2-1);i++)
{
printf("(%d x^%d) + ",p2[i].coeff,p2[i].expo);
}
printf("(%d x^%d)",p2[i].coeff,p2[i].expo);

printf("\n\n\tYour choices are:\n");
printf(" \t1:Multiplication\n \t2:Exit\n\n");
printf("\n\nPlease enter your choice: ");
scanf("%d",&ch);

switch(ch)
{
case 1:
multiply();
break;

case 2:
exit();

default:
printf("\n\nInvalid choice");
}
printf("\nPress y to continue and any other key to stop:");
fflush(stdin);
scanf("%c",&ch);
}
while(cho=='y' || cho=='Y');
getch();
}

void multiply()
{
int i=0,j=0,k=0,cnt=0,exp,coef,flag;
for(i=0;i<20;i++)
{
p3[i].coeff=0;
p3[i].expo=0;
}
i=0;
while(i {
j=0;
while(j {
flag=0;
coef=p1[i].coeff*p2[j].coeff;
exp=p1[i].expo+p2[j].expo;
for(cnt=0;cnt {
if(p3[cnt].expo==exp)
{
p3[cnt].coeff=p3[cnt].coeff+coef;
flag=1;
}
}
if(flag==0)
{
p3[k].expo=exp;
p3[k].coeff=coef;
k++;
}
j++;
}
i++;
}
printf("\nMultiplication is \n");
for(i=0;i<(k-1);i++)
{
printf("(%d x^%d) + ",p3[i].coeff,p3[i].expo);
}
printf("(%d x^%d)",p3[i].coeff,p3[i].expo);
}

Vowels Count

//Program to calculate frequency of vowels in a string

#include
#include
void main()
{
int a=0,e=0,i=0,o=0,u=0,sum=0;
char c;
clrscr();
printf("\nEnter string:- ");
printf("\nString will be terminated if you press Ctrl-Z & then ENTER.");
printf("\nSTRING:- ");
while ((c=getchar())!=EOF)
{
if (c=='a'||c=='A')
a=a+1;
if (c=='e'||c=='E')
e=e+1;
if (c=='i'||c=='I')
i=i+1;
if (c=='o'||c=='O')
o=o+1;
if (c=='u'||c=='U')
u=u+1;
}

sum=a+e+i+o+u;
printf("\n\nFrequency of vowel 'a' is %d.",a);
printf("\nFrequency of vowel 'e' is %d.",e);
printf("\nFrequency of vowel 'i' is %d.",i);
printf("\nFrequency of vowel 'o' is %d.",o);
printf("\nFrequency of vowel 'u' is %d.",u);
printf("\nTotal no. of vowels in the text is %d.",sum);
printf("\n\nHAVE A NICE DAY! BYE.");
getch();
}

Matrix Implementation

#include
#include
#include
int a[10][10],b[10][10],x[10][10];
void add()
{
int r,c,i,j,n;
cout<<"ENTER THE ORDER OF MATRIX : ";
cin>>n;
r=n;
c=n;
cout<<"ENTER THE ELEMENTS FOR MATRIX 'A' :"< for(i=0;i {
for(j=0;j {
cin>>a[i][j];
}
}
cout<<"ENTER THE ELEMENTS FOR MATRIX 'B' : "< for(i=0;i {
for(j=0;j {
cin>>b[i][j];
}
}
clrscr();

cout<<"MATRIX 'A' IS "< for(i=0;i {
for(j=0;j {
cout< }
cout< }

cout<<"MATRIX 'B' IS "< for(i=0;i {
for(j=0;j {
cout< }
cout< }
//.....................ADDITION OF MATRIX........................

for(i=0;i {
for(j=0;j {
x[i][j]=a[i][j]+b[i][j];
}
}

cout<<"THE SUM OF TWO ENTERED MATRIX IS "< for(i=0;i {
for(j=0;j {
cout< }
cout< }
}

void multiply()
{
int r1,c1,r2,c2,i,j,k;
clrscr();
cout<<"ENTER THE NO.OF ROWS OF MATRIX (A) : ";
cin>>r1;
cout<<"ENTER THE NO.OF COLOUMS OF MATRIX (A) :";
cin>>c1;
cout<<"ENTER THE ELEMENTS FOR MATRIX (A) :"< for(i=0;i {
for(j=0;j {
cin>>a[i][j];
}
}

cout<<"ENTER THE NO.OF ROWS OF MATRIX (B) : ";
cin>>r2;
cout<<"ENTER THE NO.OF COLOUMS OF MATRIX (B) : ";
cin>>c2;
cout<<"ENTER THE ELEMENTS FOR MATRIX (B) :"< for(i=0;i {
for(j=0;j {
cin>>b[i][j];
}
}

clrscr();
cout<<"MATRIX 'A' IS "< for(i=0;i {
for(j=0;j {
cout< }
cout< }

cout<<"MATRIX 'B' IS "< for(i=0;i {
for(j=0;j {
cout< }
cout< }

if(c1!=r2)
{
cout<<"MULTIPLICATION IS NOT POSSIBLE ";
}
else
{
for(i=0;i {
for(j=0;j {
x[i][j]=0;
for(k=0;k {
x[i][j]=x[i][j]+(a[i][k]*b[k][j]);
}
}
}
}

cout<<"MULTIPLICATION OF TWO MATRIX IS "< for(i=0;i {
for(j=0;j {
cout< }
cout< }
}

void main()
{
clrscr();
while(1)
{
int ch;
cout<<"

";
cout<<"...ENTER YOUR CHOICE........"<cout<<"1. ADDITION OF TWO MATRIX "<cout<<"2. MULTIPLICATION OF TWO MATRIX "<cout<<"3. EXIT "<cin>>ch;
switch(ch)
{
case 1:
add();
break;
case 2:
multiply();
break;
case 3:
exit(0);
default :
cout<<"INVALID CHOICE !! ENTER CORRECT CHOICE";
}
//getch();
}
}

LCM GCD implementation

//Finding LCM and GCD

#include
#include

void main()
{
int a[20],n,i,j,c,max,min;
unsigned long prod;
clrscr();
printf("Enter the no. of entries: ");
scanf("%d",&n);
printf("Enter the entries:");
for(i=0;i {
scanf("%d",&c);
if(c>0)
a[i]=c;
else
{
printf("Invalid Entry");
return;
}
}

max=a[0];
for(i=0;i if(a[i]>=max)
max=a[i];
min=a[0];
for(i=0;i if(a[i] min=a[i];

for(i=0,prod=1;i prod=prod*a[i];

for(i=max;i<=prod;i+=max)
{

c=0;
for(j=0;j if(i%a[j]==0)
c+=1;
if(c==n)
{ printf("The LCM of the nos: %d",i);
break;
}
}

for(i=min;i>0;i--)
{
if (min%i==0)
{
c=0;
for(j=0;j if(a[j]%i==0)
c+=1;
}
if(c==n)
{
printf("The GCD of the nos: %d",i);
break;
}
}
getch();
}

Factorial

//Factorial Function

#include
#include

long int factorial(int n);

void main()
{
int n,i;
float s,r;
char c;
clrscr();
repeat : printf("You have this series:- 1/1! + 2/2! + 3/3! + 4/4!..");
printf("To which term you want its sum? ");
scanf("%d",&n);
s=0;
for (i=1;i<=n;i++)
{
s=s+((float)i/(float)factorial(i));
}
printf("The sum of %d terms is %f",n,s);
fflush(stdin);
printf ("Do you want to continue?(y/n):- ");
scanf("%c",&c);
if (c=='y')
goto repeat;
getch();
}

long int factorial(int n)
{
if (n<=1)
return(1);
else
n=n*factorial(n-1);
return(n);
}

Bubble Sort

//Bsort, bubble sort [array]

#include
#include


void bubble_sort(int a[], int size);

int main(void)
{
clrscr();

int arr[10] = {10, 4, 2, 1, 6, 5, 8, 7, 3, 9};
int i = 0;

printf("before:\n");
for(i = 0; i < 10; i++) printf("%d ", arr[i]);
printf("\n");

bubble_sort(arr, 10);

printf("after:\n");
for(i = 0; i < 10; i++) printf("%d ", arr[i]);
printf("\n");
getch();

return 0;
}

void bubble_sort(int a[], int size)
{
int switched = 1;
int hold = 0;
int i = 0;
int j = 0;

size -= 1;

for(i = 0; i < size && switched; i++)
{
switched = 0;
for(j = 0; j < size - i; j++)
if(a[j] > a[j+1])
{
switched = 1;
hold = a[j];
a[j] = a[j + 1];
a[j + 1] = hold;
}
}

getch();
}

Binary Search

//Binary search [int array]

#include
#include

#define TRUE 0
#define FALSE 1

int main(void)
{
int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int left = 0;
int right = 10;
int middle = 0;
int number = 0;
int bsearch = FALSE;
int i = 0;

printf("ARRAY: ");
for(i = 1; i <= 10; i++)
printf("[%d] ", i);

printf("\nSearch for Number: ");
scanf("%d", &number);

while(bsearch == FALSE && left <= right)
{
middle = (left + right) / 2;
if(number == array[middle])
{
bsearch = TRUE;
printf("** Number Found **\n");
}
else
{
if(number < array[middle]) right = middle - 1;
if(number > array[middle]) left = middle + 1;
}
}

if(bsearch == FALSE)
printf("-- Number Not found --\n");
getch();


return 0;
}

NIS MD5

/* Implementation of MD5 */

#include
#include
#include
#include
#include

unsigned long leftrotate(unsigned long,int);
double myabs(double x);

int main()
{
clrscr();
char tempchar;
int m,h;
char fileName[75];
char message[1000];
FILE *fp;
char ch;
unsigned long temp;
unsigned long w[20];
int n;
unsigned long sineInt[64];
int i;

int r[64]={7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21};
for(i=0;i<64;i++)
{
sineInt[i]=(unsigned long)floor(myabs(sin(i+1)*pow(2,32)));
}
//printf("\nEnter name of the file containing message:");
fp=fopen("c:\\message.txt","r");

i=0;
while(!feof(fp))
{
ch=fgetc(fp);
message[i]=ch;
i++;
}
message[i-1]=0x80;
message[i]='\0';
int no_of_bits=strlen(message)*8;
int message_length=no_of_bits-8;
unsigned long msg_length=message_length;

int bits_to_pad=((512-(no_of_bits%512))+448)%512;

int j=0;
for (j=0;j{
message[i+j]=0x00;
}

message[i+j]='\0';
i=i+j;

unsigned char *ptrchar;
ptrchar= (unsigned char *)(&msg_length);
message[i]=ptrchar[0];
message[i+1]=ptrchar[1];
message[i+2]=ptrchar[2];
message[i+3]=ptrchar[3];
message[i+4]=0x00;
message[i+5]=0x00;
message[i+6]=0x00;
message[i+7]=0x00;

i=i+8;

unsigned long A,B,C,D;

A=0x67452301;
B=0xefcdab89;
C=0x98badcfe;
D=0x10325476;

unsigned long a,b,c,d,f,g;

char message_chunk[70];
int no_of_chunks=(i*8)/512;
int k;
for(j=0;j{
for(k=0;k<64;k++)
{
message_chunk[k]=message[(j*64)+k];
}

for(n=0;n<16;n++)
{
w[n]=*((unsigned long *)(&message_chunk[n*4]));
}


a=A;
b=B;
c=C;
d=D;

for(k=0;k<64;k++)
{
if (k>=0 && k<=15) //round one
{
f=(b & c) | ((~b) & d);
g=k;
}
else if(k>=16 && k<=31) //round two
{
f=(b & d) | (c & (~d));
g=(5*k+1) % 16;
}
else if(k>=32 && k<=47) //round three
{
f=b^c^d;
g=(3*k+5)%16;
}
else if(k>=48 && k<=63) //round four
{
f=c ^ (b | (~d));
g=(7*k)%16;
}
temp=d;
d=c;
c=b;
b=b+leftrotate((a+f+sineInt[k]+w[g]),r[k]);
a=temp;

}
A=A+a;
B=B+b;
C=C+c;
D=D+d;
}

printf("\nThe MD5 hash is:");
ptrchar=(unsigned char *)(&A);
for (h=0;h<4;h++)
printf("%0.2X",ptrchar[h]);
cout<<" ";

ptrchar=(unsigned char *)(&B);
for (h=0;h<4;h++)
printf("%0.2X",ptrchar[h]);
cout<<" ";

ptrchar=(unsigned char *)(&C);
for (h=0;h<4;h++)
printf("%0.2X",ptrchar[h]);
cout<<" ";

ptrchar=(unsigned char *)(&D);
for (h=0;h<4;h++)
printf("%0.2X",ptrchar[h]);

getch();
return 0;
}



//This function circularly left-shifts 'x' by 'c' bits
unsigned long leftrotate(unsigned long x,int c)
{
return ((x<>(32-c)));
}
double myabs(double x)
{
if (x<0)
return -1*x;
else
return x;
}


/*
OUTPUT

Enter name of the file containing message:abc.txt
The message is:The quick brown fox jumps over the lazy dog.
The MD5 hash is:E4D909C2 90D0FB1C A068FFAD DF22CBD0

Enter name of the file containing message:abc.txt
The message is:The quick brown fox jumps over the lazy dog
The MD5 hash is:9E107D9D 372BB682 6BD81D35 42A419D6
*/

NIS RSA Algorithm

#include
#include
#include

void main()
{
clrscr();
unsigned long p,q,n,m,M,e,d,i,C,M1;
cout<<"Enter value of P : ";
cin>>p;
cout<<"Enter value of Q : ";
cin>>q;
n=p*q;
m=(p-1)*(q-1);
for(e=1;e {
if(m%e!=0)
break;
}
d=0;
do
{
d++;
i=(((e*d)-1)%m);
}while(i!=0);
cout<<"e : "< cout<<"d : "< cout<<"Enter value of M : ";
cin>>M;
C=pow(M,e);
C=C%n;
cout<<"Encryption C : "<
M1=pow(C,d);
M1=M1%n;
cout<<"Decryption M1 : "<
getch();
}

NIS Port Scanning

import java.net.*;
import java.io.*;
class Port
{
public static void main(String args[]) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String host;
int start,end,avail,unavail,i;
Socket sk;
avail=0;
unavail=0;
System.out.println("Enter the host name : ");
host=br.readLine();
System.out.println("Enter the starting port no : ");
start=Integer.parseInt(br.readLine());
System.out.println("Enter the ending port no : ");
end=Integer.parseInt(br.readLine());
for(i=start;i<=end;i++)
{
System.out.print("Port No. " + i);
try
{
sk=new Socket(host,i);
System.out.println(" : Available");
avail++;
}
catch(Exception E)
{
System.out.println(" : Unavailable");
unavail++;
}
}
System.out.println("Total available port : " + avail);
System.out.println("Total unavailable port : " + unavail);
}
}

NIS Host-IP & Vice versa

import java.io.*;
import java.net.*;

class Host
{
public static void main(String args[]) throws UnknownHostException
{
InetAddress in_obj;
String str;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//get name of local computer & initialise the object
in_obj=InetAddress.getLocalHost();
System.out.println("getLocalHost : " + in_obj);
System.out.println();
//get name of local computer
str=in_obj.getHostName();
System.out.println("getHostName : " + str);
System.out.println();
//get canonical host name [local computer]
str=in_obj.getCanonicalHostName();
System.out.println("getCanonicalHostName : " + str);
System.out.println();
//get Host address [local computer]
str=in_obj.getHostAddress();
System.out.println("getHostAddress : " + str);
System.out.println();
//get remote pc info
in_obj=InetAddress.getByName("localhost");
System.out.println(in_obj);
}
}

NIS One time padding

Code :
#include
#include
#include
void main(int argc,char *argv[])
{
FILE *ip, *key, *op;
unsigned char ic, kc, oc;
clrscr();
if(argc!=4)
{
printf("Not valid parameter list...");
}
else
{
fseek(ip,SEEK_SET,0);
ip=fopen(argv[1],"r");
key=fopen(argv[2],"r");
op=fopen(argv[3],"w");
if( (ip==NULL) || (key==NULL) || (op==NULL) )
{
printf("File opening error...");
}
else
{
fread(&ic, sizeof(unsigned char), 1, ip);
do
{
fread(&kc, sizeof(unsigned char), 1, key);
oc=ic ^ kc;
printf("%c",ic);
fwrite(&oc, sizeof(unsigned char), 1, op);
}while(fread(&ic, sizeof(unsigned char), 1, ip));
}
fclose(op);
fclose(key);
fclose(ip);
}
getch();
}

Key File
QWERTYUIOPASDFGHJKLZXCVBNM

NIS Diffe Helman Program

#include
#include
#include

long double mod (long double q,long n)
{
long double rem=0, quo;
quo=q/n;
quo=floor(quo);
rem=q-(quo*n);
return rem;
}

int check_root(long int q,long int a)
{
long double arr[100];
int i,j,k=0,flag=1;
for(i=1;i {
arr[k]=mod(pow(a,i),q);
k++;
}
for(i=0;i {
for(j=0;j {
if ((i!=j) && (arr[i]==arr[j]))
{
flag=0;
break;
}
}
}
return flag;
}
void main()
{
clrscr();
long q,prem_root=2;
long p_A,k_A,p_B,k_B,pub_A,pub_B;
cout<<"Enter prime no : ";
cin>>q;
do
{
prem_root++;
}while(check_root(q,prem_root));

cout<<"Enter private key of A : ";
cin>>p_A;
pub_A=mod(pow(prem_root,p_A),q);

cout<<"Enter private key of B : ";
cin>>p_B;
pub_B=mod(pow(prem_root,p_B),q);

k_A=mod(pow(pub_B,p_A),q);
k_B=mod(pow(pub_A,p_B),q);

cout<<"Public key A : "< cout<<"Public key B : "< if(k_A==k_B)
{
cout<<"Key exchange successful...";
}
else
{
cout<<"Key exchange unsuccessful...";
}
getch();
}

Sunday, January 31, 2010

Invitation to join Amulyam-Free Prepaid Mobile Recharge and Movie Tickets

Invitation to join Amulyam-Free Prepaid Mobile Recharge and Movie Tickets

Happy to invite you to join Amulyam,that gives considerable amount of free prepaid mobile recharge and
free movie tickets immediately for doing what you normally do online:creating accounts on
social networking websites, photo sharing websites,video sharing websites,buying train tickets..etc.

Create your amulyam account and refer your friends to get more prepaid mobile recharge and movie tickets for free.

You can copy and paste below link to the address bar of your browser
or Click Here to create your account on amulyam.


http://www.amulyam.in/register.do?id=07d6101f-4dd1-4065-96a4-7ef021426cb9&sid=1


Viraj Kulkarni