|
@@ -39,24 +39,24 @@ namespace Encrypter
|
|
|
|
|
|
|
|
|
|
|
|
- char[] symb = dictionarys.Select(q => q.Key).ToArray();
|
|
|
+ //char[] symb = dictionarys.Select(q => q.Key).ToArray();
|
|
|
|
|
|
- char[] newSymb = new char[uniqueSymbCount];
|
|
|
+ //char[] newSymb = new char[uniqueSymbCount];
|
|
|
|
|
|
//foreach (KeyValuePair<char, int> keyValuePair in dictionarys)
|
|
|
//{
|
|
|
// //keyValuePair.Value;
|
|
|
// MessageBox.Show($"{keyValuePair.Key} : {keyValuePair.Value}");
|
|
|
//}
|
|
|
- byte startSymb = 100;
|
|
|
+ //byte smb = 100;
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < newSymb.Length; i++)
|
|
|
- {
|
|
|
- newSymb[i] = Encoding.Unicode.GetChars(startSymb);
|
|
|
- startSymb++;
|
|
|
- MessageBox.Show(newSymb[i].ToString());
|
|
|
- }
|
|
|
+ //for (int i = 0; i < newSymb.Length; i++)
|
|
|
+ //{
|
|
|
+ // newSymb[i] = Convert.ToChar(smb);
|
|
|
+ // smb++;
|
|
|
+ // MessageBox.Show(newSymb[i].ToString());
|
|
|
+ //}
|
|
|
|
|
|
//foreach (char c in sposob1_input.Text)
|
|
|
//{
|
|
@@ -73,12 +73,28 @@ namespace Encrypter
|
|
|
}
|
|
|
private void sposob2_encrypt(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+ string input = sposob2_input.Text, output = "";
|
|
|
+ int pos = 0;
|
|
|
+ Byte[] encodedBytes = ascii.GetBytes(input);
|
|
|
+ foreach (Byte b in encodedBytes)
|
|
|
+ {
|
|
|
+ output += $"{b+pos}%";
|
|
|
+ pos++;
|
|
|
+ }
|
|
|
+ sposob2_output.Text = output;
|
|
|
}
|
|
|
private void sposob2_decrypt(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
+ string input = sposob2_input2.Text, output = "";
|
|
|
+ int pos = 0;
|
|
|
+ while (input.IndexOf('%') != -1)
|
|
|
+ {
|
|
|
+ byte temp = Convert.ToByte(Convert.ToInt32(input.Substring(0, input.IndexOf('%'))) - pos);
|
|
|
+ pos++;
|
|
|
+ output += Convert.ToChar(temp);
|
|
|
+ input = input.Remove(0, input.IndexOf('%') +1);
|
|
|
+ }
|
|
|
+ sposob2_output2.Text = output;
|
|
|
}
|
|
|
private void sposob3_encrypt(object sender, RoutedEventArgs e)
|
|
|
{
|
|
@@ -96,12 +112,10 @@ namespace Encrypter
|
|
|
while (input.IndexOf($"%{count}^?") != -1)
|
|
|
{
|
|
|
byte temp = Convert.ToByte(Convert.ToInt32(input.Substring(0, input.IndexOf($"%{count}^?"))) - count);
|
|
|
- //MessageBox.Show(temp.ToString());
|
|
|
output += Convert.ToChar(temp);
|
|
|
input = input.Remove(0, input.IndexOf($"%{count}^?") + 3 + count.ToString().Length);
|
|
|
}
|
|
|
sposob3_output2.Text = output;
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|