Encrypt/Decrypt text

This is a discussion on Encrypt/Decrypt text within the C Programming forums, part of the General Programming Boards category; Hi, I am trying to encrypt and decrypt plain text using following six square method Can anyone pls provide help ...

  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
    21,408
    What have you tried?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    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.>
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    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
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Now, I get it !

    btw.. Would there be a way to get back the original if it(which character uses which 'cryptogram') was randomised ?
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    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


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