prince shils

prince shils

  • NA
  • 9
  • 14k

CryptoGraphic Message

Mar 28 2012 1:48 PM
HELLO FRIENDS,

I m creating a CRYPTOGRAPHY WINDOWS FORM APPLICATION.
1-Calculate String Length. (ALREADY DONE)
2-Reverse the String. (ALREADY DONE)
3-Total Length of the message will be save and each character of the message will be replaced from it. (HELP REQUIRED)

Example:
You wrote a message " A CAT"

so STEP 1: calculate Length : 5
STEP 2: reverse : TAC A
STEP 3 : String length is added: so 5 is added to each corresponding character

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Therefore,
A is at 1 , when 5 is added it will become F which is 6,
C is at 3, when 5 is added it will become H, which is 8,
A is again replaced with F
T is at 20, when 5 is added it will become Y, which is 25

Therefore, A message "A CAT" will become " F HFY"


So far i done that:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public string UIT_CRYPTOGRAPHY()
{

string userString = richTextBox1.Text;
char[] textArray = userString.ToCharArray();
int stringLength = userString.Length;
Array.Reverse(textArray);
label1.Text = new string(textArray);

return label1.Text;

}

private void button3_Click(object sender, EventArgs e)
{
/* string[] stringArray = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z" };*/

string ReverseString = UIT_CRYPTOGRAPHY();
label1.Text = ReverseString;
}

PLEASE HELP ME
THANKS IN ADVANCE.

Answers (7)