Subscribe to Get Free Material Updates!
Visit my new blog WebData Scraping - Web Scraping Service provider company in India.

Program to Encode the Message Using Caecer Cipher.


#include<stdio.h>
#include<string.h>

char ciper_en(char);
char ciper_dn(char);
char a[27]={'a','b','c','d','e','f','g','h','i','j','k','l','m',
                     'n','o','p','q','r','s','t','u','v','w','x','y','z',' '};
int main()
{
        char s[10],s1[20],s2[20];
        int i,j;
        printf("\n Enter the string:");
        gets(s1);
        for(i=0;s1[i];i++)
                s2[i]=ciper_en(s1[i]);
        for(j=0;s2[j];j++)
                s[j]=ciper_dn(s2[j]);
        printf(" \n Before Decryption ...%s ", s1);
        printf(" \n After Decryption ...%s\n ", s2);
        printf(" \n After Encryption...%s \n ", s);

}

 
char ciper_en(char a1)
{
        int i;
        if(a1==' ')
                return a1;

        for(i=0;i<26;i++)
        {
                if(a[i]==a1)
                {
                        break;
                }
        }
        return a[(i+3)%26];
}


char ciper_dn(char a1)
{
        int i;
        static int n=1;
        if(a1==' ')
                return a1;
        for(i=0;i<26;i++)
        {
                if(a[i]==a1)
                {
                        break;
                }
        }
        if(i<=2)
                i=(25+i+1);
        return a[(i-3)%26];
}

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes