Computer Graphics Program source codes with full description.

Study of Various C Graphics Functions

Implementation and Using mouse in DOS

Implementation of DDA line algorithm with source code in C/C++.

Implementation of Bresenham Line algorithm with source code in C/C++.

Implementation of Midpoint Line algorithm with source code in C/C++.

Implementation of Bresenham Circle algorithm with source code in C/C++.

Implementation of Mid-point Circle algorithm with source code in C/C++.

Implementation of Mid-point Ellipse algorithm with source code in C/C++.

Implementation of Polygon Filling using Scan Fill with source code in C/C++.

Implementation of Polygon Filling using Flood Fill with source code in C/C++.

Implementation of Polygon Filling using Boundary Fill Algorithms.

Implementation of algorithm of 2D Transformation of an Object with source code in C/C++.

Implementation of Line Clipping using Cohen- Sutherland algorithm with source code in C/C++.

Implementation of Line Clipping using Liang-Barky algorithm with source code in C/C++.

Implementation of Polygon clipping using Sutherland-hodgeman algorithm with source code in C/C++.

Search

Friday 24 June 2011

Monoalphabetic cipher encryption-decryption.

The source code of Monoalphabetic cipher encryption-decryption is as follows..



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

void main()
{
            int i,j,pt,a3,a4,a;
            char a1[50],s1[10],a2[50],s2[50];
            clrscr();

            printf("Enter 0 for capital or 1 for Small latters\n");
            printf("Enter ; at the end of the plaintext\n");

            scanf("%d",&a);


            switch(a)
            {
             case 0:
             {
                        for(i=0;i<26;i++)
                        {
                                    a1[i]=i+65;
                                    printf("%c",a1[i]);

                        }

            printf("\nEnter values for each charater\n");

                        for(i=0;i<26;i++)
                        {

                                    cscanf("%c",&a2[i]);

                        }

             printf("\nEnter the plain text\n");


                        for(i=0;i<100;i++)
                        {
                                    cscanf("%c",&s1[i]);
                                    if(s1[i]==';')
                                         {     s1[i]='\0';
                                                break; }

                        }

            a3=strlen(s1);
            printf("\nThe cyfer text is:");
            for(i=0;i<a3;i++)

                        {for(j=0;j<26;j++)

                                    {       if(s1[i]==' ')
                                                  { printf(" ");}

                                           else if(s1[i]==a1[j])
                                                {

                                                    printf("%c",a2[j]);

                                                }

                                    }
                        }
                        break;   }
              case 1:
              {
                        for(i=0;i<26;i++)
                        {
                                    a1[i]=i+97;
                                    printf("%c",a1[i]);

                        }

                        printf("\nEnter values for each charater\n");

                        for(i=0;i<26;i++)
                        {
                                    cscanf("%c",&a2[i]);

                        }

                         printf("\nEnter the plain text\n");
                         for(i=0;i<26;i++)
                        {
                                    cscanf("%c",&s2[i]);
                                    if(s2[i]==';')
                                         {     s2[i]='\0';
                                                break; }


                        }

                        a4=strlen(s2);
                        printf("\nThe cyfer text is:");

                        for(i=0;i<a4;i++)

                                    {          for(j=0;j<26;j++)

                                           if(s2[i]==' ')
                                                { printf(" ");}
                                           else           {
                                                            if(s2[i]==a1[j])
                                                            {
                                                            printf("%c",a2[j]);
                                                            }

                                                }
                                    }
                }
               }
getch();

}

output:



3 comments:

  1. how to decrypt??? plz show some example...!!

    ReplyDelete
  2. qepgpxbakzyabdckzbbapzeqgpxnpqbrdvprpspponrdooepgpxbakzyabdc
    kzbbaptxkcoprnksbaqntodepbdbdooyokcdoidxrqeyxdvqkdubqgpnqbpn
    qrtpxqdoqnbquixkeyndevdeqrdoxqyabnekiajbaqehksdoobapcdvbaqey
    niapeoqspqnnkykkviajapotiqbadedriapebapxpndoidjndukzovopbbap
    iadopnikxxjdckzbbaptkqnkenqebapnpdkzbnqvpksudoqskxeqdqbnskxp
    qyetkoqujqvkebidebuadeypnqadgpekxpdubqkenjkzxvqoprrdndxprjvq
    nbxdubqkenbadbnekidjbkyksxdeukzedrpxqudeqepgpxokkhpvdxkzevep
    gpxnpukevyzpnnpvbapeqxpdvnkrpakidxvwqeeekiqrdoidjnvptxpnnpvd
    evekiqudebnopptsxkrjpdxnksdtdbajdoocpudznpqxpdvdoqbbopekdrua
    krnhjqrpdbqeygpypbdbqkeudznpkssdnbskkvedbqkeqripdxqeyzeukrsk
    xbdcopnakpnudznpksyokcdoqwdbqkeqridbuaqeyrquadporkkxppmtknpb
    apdiszobxzbaqroqnbpeqeybktzcoqupeprjdevxpdydejkzba


    how to decrypt using monoalphabatic i tried and tried i m not getting so plese help.....!!!! :-(

    ReplyDelete

Copyright Text

Copyright @ LDRP Student Community, webmaster Rahul Bhadauriya