Playfair matrix retreiving

This is a discussion on Playfair matrix retreiving within the C++ Programming forums, part of the General Programming Boards category; hello everyone, i am making a programme on the playfair matrix in which both cipher text and plain text is ...

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    3

    Playfair matrix retreiving

    hello everyone,
    i am making a programme on the playfair matrix in which both cipher text and plain text is given to me and im ought to retrieve the KEYWORD.
    i m stuck at a point where im suppose to start entering the elements in the 5*5 matrix because when i got a starting point,i m not getting it how/where to place it in the matrix since each pair can be placed according to 3 rules(ERDL,ECDL,RECTANGULARLY) and every initial entry can be placed in 25 ways.
    kindly reply
    http://www.umich.edu/~umich/fm-34-40-2/ch7.pdf(pg:7-12 onwards)
    Playfair cipher - Wikipedia, the free encyclopedia
    Last edited by Salem; 11-09-2012 at 02:45 AM. Reason: tagfest cleanup

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    I think you should post some code, what basically you tried so far. Then people can help on that. Otherwise you would need people to actually go and read all those PDF pages to even understand the issue which is not that efficient

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    3
    this is what i have done so far.
    stuck at a point where im suppose input the array at random places.



    Code:
    #include<iostream>
    #include<conio.h>
    #include<stdio.h>
    #include<cmath>
    using namespace std;
    int main()
    {
        char p[300],c[300],a[25][26];
        int n,l,l2;
    
    
        cout<<"ENTER THE PLAIN TEXT : \n"; /*what should be the procedure to eradicate special character case,
        if any.(by comparing ASCII codes but how??)*/
        for(int i=0;i<300;i++)
        {
            cin>>p[i];
            if(p[i]=='.')
            {
                l=i;
               break;
            }
        }
        cout<<"\n\nENTER THE CIPHER TEXT : \n";
        for(int k=0;k<300;k++)
        {
            cin>>c[k];
            if(c[k]=='.')
            {
                if(k%2!=0)
                {
                    cout<<"\n\nINVALID CIPHER TEXT(CANNOT PAIR IN DIAGRAPHS) ";//How to exit from the program??.
                }
                else
                {
                    break;
                }
            }
        }
        l2=l;
        for(int i=0;i<l2;i++)
        {
            if(i%2!=0)
            {
                if(p[i-1]==p[i])
                {
                    p[i]='x';
                    for(int j=l2;j>=i+1;j--)
                    {
                        p[j+1]=p[j];
                    }
                    l2++;
                    p[i+1]=p[i-1];
                }
    
    
            }
            else
            {
                continue;
            }
        }
        cout<<endl<<endl;
        for(int i=0;i<l2;i++)
        {
            if(i%2!=0)
            {
            cout<<p[i]<<" ";
            }
            else if(i==(l2-1)&&i%2==0)
            {
                cout<<p[i]<<'x';
    
    
            }
            else
            {
                cout<<p[i];
            }
        }
        cout<<"\n\n";
                //DECRYPTING
        for(int i=0;i<l2;i++)
        {
            if(i%2!=0)
            {
    
    
                if(p[i-1]==c[i])
                {
                
                }
            }
        }
        return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. /Retreiving information from /proc
    By jack500 in forum C Programming
    Replies: 3
    Last Post: 09-26-2009, 10:29 AM
  2. retreiving variable from within loop.
    By lilrayray in forum C Programming
    Replies: 21
    Last Post: 08-07-2006, 06:04 AM
  3. Retreiving File create/modify date
    By super_stripey in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2004, 08:34 AM
  4. Bitwise Operators - Setting and Retreiving a Bit
    By Spono in forum C Programming
    Replies: 2
    Last Post: 11-04-2003, 02:09 PM
  5. retreiving console window text
    By mayhem in forum Windows Programming
    Replies: 2
    Last Post: 09-10-2003, 10:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21