Thread: Encrypt/Decrypt text

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    8

    Encrypt/Decrypt text

    Hi,

    I am trying to encrypt and decrypt plain text using following six square method Can anyone pls provide help on how to achieve this using array programming

    Square-1
    a b c d e
    f g h i j
    k l m n o
    p r s t u
    v w x y z

    Square-2
    f g h i j
    k l m n o
    p r s t u
    v w x y z
    a b c d e

    Square-3
    k l m n o
    p r s t u
    v w x y z
    a b c d e
    f g h i j

    Square-4
    g m r i t
    a b c d e
    f h j k l
    n o p s u
    v w x y z

    Square-5
    a b c d e
    f h j k l
    g m r i t
    n o p s u
    v w x y z

    Square-6
    a b c d e
    f h j k l
    n o p s u
    v w x y z
    g m r i t

    It uses six 5 by 5 matrices each arranged in a square, as shown in table-1.Each of the 5 by 5 matrices contains the letters of the alphabet (usually omitting "Q" to reduce the alphabet to fit into the square)

    While scanning the plain text the first alphabet’s plain text is in square-1 and its cipher is in same row and column location of square-4. The second alphabet, its plain text is in square-2 and cipher text is in same row and column location of square-5. The third alphabet, its plain text is in square-3 and cipher text is in same row and column location of square-6

    For example if the plain text is:

    Professor Khurana will arrive

    It’s cipher text is:

    nmeazjplh fclovdg oihh vomivz gs

    Thanks in Advance!!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What have you tried?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by patneel View Post
    Hi,

    I am trying to encrypt and decrypt plain text using following six square method Can anyone pls provide help on how to achieve this using array programming
    Click here.... Homework Policy

    Post some code showing your attempt... we'll see what we can do.

  4. #4
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    While scanning the plain text the first alphabet’s plain text is in square-1 and its cipher is in same row and column location of square-4. The second alphabet, its plain text is in square-2 and cipher text is in same row and column location of square-5. The third alphabet, its plain text is in square-3 and cipher text is in same row and column location of square-6
    I'm, by no means knowledgeable about cryptography, but something about this problem seems odd to me.
    Why do we have to use 6 matrices when the plain-text can be (bijectively) mapped into the encrypted one(in this case). Wouldn't it be simpler to generate a list of "what to replace by what" and do the conversion ?
    Also, square 5 and 6 has the same first(and second) row. Wouldn't that give rise to some ambiguity when converting back to the original text ?

    <If these questions seem foolish, can anyone tell me what this is called. I'd like to read up a bit on it; seems interesting.>

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    The idea is that you have three different ciphers (they are each a one-to-one mapping) and that you use them each in turn (so the first letter of the message uses the first cipher, the second uses the second, ..., the fifth uses the second, the sixth uses the third, ...). It's not quite a Vigenere cipher, just three separate cryptograms.

  6. #6
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Now, I get it !

    btw.. Would there be a way to get back the original if it(which character uses which 'cryptogram') was randomised ?

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    If you knew the random key that was used to generate the randomness. Otherwise you'll have three choices for each letter, and then it comes down to the fact that "the" is a lot more common than "xhk".

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [Help Me]Very Simply Encrypt/Decrypt
    By ShiroAzure in forum C++ Programming
    Replies: 11
    Last Post: 04-18-2011, 12:58 PM
  2. decrypt/encrypt
    By wonderpoop in forum C Programming
    Replies: 15
    Last Post: 10-18-2006, 06:10 PM
  3. Encrypt/Decrypt files by XOR
    By amirahasanen1 in forum C++ Programming
    Replies: 27
    Last Post: 05-22-2005, 02:38 PM
  4. Encrypt/Decrypt
    By bitWise in forum C Programming
    Replies: 2
    Last Post: 10-14-2001, 03:48 PM
  5. how to encrypt/decrypt
    By bitWise in forum C Programming
    Replies: 3
    Last Post: 10-13-2001, 01:02 PM

Tags for this Thread