Skip to content

Commit

Permalink
Поддержка кириллицы.
Browse files Browse the repository at this point in the history
  • Loading branch information
sven4500 committed Jun 6, 2021
1 parent d2e96ce commit cf3054d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion EncryptionPage/EncryptionPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public EncryptionPage()

private void EncryptButton_Click(object sender, RoutedEventArgs e)
{
byte[] inputBytes = Encoding.ASCII.GetBytes(InputTextBox.Text);
byte[] inputBytes = Encoding.Default.GetBytes(InputTextBox.Text);
EncryptedMessage = Utils.Encrypt(inputBytes, E, N);

InputBinTextBox.Text = Utils.ToString(inputBytes);
Expand Down
6 changes: 1 addition & 5 deletions KeyGeneratorPage/KeyGeneratorPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,10 @@ private void GenerateButton_Click(object sender, RoutedEventArgs e)
where prime < Totient && GCD(prime, Totient) == 1
select prime;

E = ee.ElementAt(rand.Next(ee.Count()));
E = (ee.Count() > 0) ? ee.ElementAt(rand.Next(ee.Count())) : 0;

// 3. Находим d.
D = modInverse(E, Totient);

// Проверка.
Debug.Assert(GCD(E, Totient) == 1);
Debug.Assert((E * D) % Totient == 1);
}
}
}

0 comments on commit cf3054d

Please sign in to comment.