# Thread: Help Reverse|Decryption algorithm

1. ## 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. 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. No one seem to answer my question.. I know some of you guys out there can do this..

4. 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. 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. 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. 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