Thread: Help Reverse|Decryption algorithm

  1. #1
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683

    Help Reverse|Decryption algorithm

    Hi all..
    I have developed a simple algorithm (similar to encryption) below.. The problem is i am able to encrypt a string with a key. but not able to get it back with the same key. i know this algorithm is reversible.. help me on how to do it.. Below is the program (attached)

    Thanx

  2. #2
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Here is more details on how my encryption works

    I have created a array of 26 x 26 holding all alphavets in the following manner

    A B C D E F G H I ..........X Y Z
    B C D E F G H I J ..........Y Z A
    C D E F G H I J K ..........Z A B
    D E F G H I J K L...........A B C
    .
    .
    .
    .
    .
    Z A B C D E F G H.........W X Y



    So what the program does is bases in the key it selects the line. FOr example if the key's 1 char is b it selects the second line. If it is c it selects the third line and so on. SO based on this if the user input's first char is say d. Then it selects the 3rd char from the line selected using the key. After the last char of the key to encrypt the remaining text the keys value is used from the begining. Hope you understood it.

    Now i need help from you to write a program to reverse this. that is if the user inputs the key and the encrypted message the original message must be generated.

    Hope you guys can help me..
    Thanx

  3. #3
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    No one seem to answer my question.. I know some of you guys out there can do this..

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    OK, some tips

    1. its int main, not void main

    2. main is over 350 lines long - use some functions, and simplify!

    3. Learn to indent properly, it will help you figure out what is going on.

    4. this doesn't work as you want
    if(argv<2 | argv>2)

    Firstly, it should be argc, not argv, and secondly, its ||, not |
    so
    if ( argc < 2 || argc > 2)
    or even
    if ( argc != 2 )

    5. Instead of lots of things like
    if(encr[i]=='a' || encr[i]=='A')
    index1=0;
    Try
    index1 = (toupper(encr[i])) - 'A';
    Does all 52 letters in one line of code

  5. #5
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    THose mistakes.. I am also noticing now.. I did that prog in a hurry.. Thanks for you help on those.. Thank you.. But can any one please help me with the algorithm to decode a message with the key...

  6. #6
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    I have d oubt.. Why does Min take more char inputs than void mailn. DOes any one know.... But please dont continue this complete thread answering this.. My main problem is the above one... I am trying my self to reverse it.. But with some problems.... I will post what i have done in few hours may be you could work on it to help me..

    Thanx

  7. #7
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Hi guys,
    I HAVE SLOVED IT.. Thanks for you help.. But dont crack your head any more since i have solved it.. I have created a new thread called " Cracking contect" i have posted the complete working prog there check it out..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implement of a Fast Time Series Evaluation Algorithm
    By BiGreat in forum C Programming
    Replies: 7
    Last Post: 12-04-2007, 02:30 AM
  2. Replies: 4
    Last Post: 12-10-2006, 07:08 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM