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 Mono Alphabetic Sub-Stitution Cipher


#include<stdio.h>

char monocipher_encr(char);
char alpha[27][3]={
{'a','f'}, {'b','a'}, {'c','g'}, {'d','u'}, {'e','n'}, {'f','i'}, {'g','j'}, {'h','k'}, {'i','l'}, {'j','m'}, {'k','o'}, {'l','p'}, {'m','q'}, {'n','r'}, {'o','s'}, {'p','t'}, {'q','v'}, {'r','w'}, {'s','x'}, {'t','y'}, {'u','z'}, {'v','b'}, {'w','c'}, {'x','d'}, {'y','e'}, {'z','h'}
};
char str[20];

int main()
{
        char str[20],str2[20];
        int i;
        printf("\n Enter String..");
        gets(str);
        for(i=0;str[i];i++)
                str2[i]=monocipher_encr(str[i]);
        printf("\n Before Decryption..%s",str);
        printf("\n After Decryption..%s\n",str2);
}
char monocipher_encr(char a)
{
        int i;
        for(i=0;i<27;i++)
        {
                if(a == alpha[i][0])
                        break;
        }
        return alpha[i][1];
}

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

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