I have been just learning about the basics of cryptography, and I wanted to give
one of the methods called zigzag transposition a try.
All this method does is combining the entire sentence and give them index starting from zero.
it then separates the even indexed characters into an array and the odd ones into a different array .
When I convert the two arrays to strings and then place them in a textbox only the first string shows up.
private void ZigzagBu_Click(object sender, EventArgs e) {
string s = PlaintextTB.Text;
s = s.Replace(" ","");
char[] whole = s.ToCharArray();
char[] even = new char[whole.Length];
char[] odd = new char[whole.Length];
int evenIndex = 0;
int oddIndex = 0;
for(int i =0;i<whole.Length;i++) {
if (i % 2 == 0) {
even[evenIndex] = whole[i];
evenIndex++;
}
else {
odd[oddIndex] = whole[i];
oddIndex++;
}
}
s = new String(even);
string m = new String(odd);
CiphertextTB.Text = s+m;
}