View Single Post
Pro contributor
7Oct2010,02:50  
virxen's Avatar
Code:
.........
private String key; 
public SecretCode(String theKey) 
{ 
this.key=theKey;
} 
public String encrypt(String clearText) 
{ 
String encryptedText="";
.......
return encryptedText;
} 
public String decrypt(String cipherText) 
{ 
String decryptedText="";
.......
return decryptedText;
}
this is a small help to help you start.

now from what i understood from this you want to do:
first of all Encrypt
==================
you have a string-->clearText
you have a key-->key
you have the ORDERED Key.

you must process each letter of clearText (for loop)
find its order inside ORDERED string (for loop) and get the char at the same position from
the key and replace the unEncrypted char with the encrypted one,
finally return encrypted string.

now with this in mind send your new code in order to help you.