Read without ads and support Scribd by becoming a Scribd Premium Reader.
 
 
PROBLEM STATEMENT:
Implementation of ceaser cipher & perform Brute Force Attack on ceasercipher.
PROGRAM:
#include<stdio.h>#include<string.h>void main(){char str[50];char c[50],c1[50];int n=0, x, a,i=0,key, key1,j,sub;printf("Enter Plain text:-") ;gets(str);n=strlen(str);printf("Enter the key :-");scanf("%d",&key);if(key>26)key1= key %26;for(i=0;str[i]!=NULL;i++){x=str[i];if(x==32){c[i]=32;printf("%c",c[i]);}if(x>=65 && x<=90){if( (x+key) >90 ){c[i]=64+x+key-90;}else{c[i]=x+key;}}if(x>=97 && x<=122){if( (x+key) >122 ){c[i]=96+x+key-122;}
 
else{c[i]=x+key;}}}printf("Cypher text is:-%s",c);strcpy(c1,c);printf("Brute Force\n\n");for(key=26 ; key >= 0 ; key--){for(i=0;str[i]!=NULL;i++){x=c[i];if(x==32){c[i]=32;printf("%c",c1[i]);}if(x>=65 && x<=90){if( (x+key) >90 ){c1[i]=64+x+key-90;}else{c1[i]=x+key;}}if(x>=97 && x<=122){if( (x+key) >122 ){c1[i]=96+x+key-122;}else{c1[i]=x+key;}}}printf("\nPlain text is :-%s",c1);}}
Search History:
Searching...
Result 00 of 00
00 results for result for
  • p.
  • Notes
    Load more