private void encodeButton_Click(object sender, RoutedEventArgs e) { PowerEncoding powerEncoding = new PowerEncoding(); resultBox.Text = powerEncoding.Encode(inputBox.Text); if(resultBox.Text.Length/4 != inputBox.Text.Length) { ModernDialog.ShowMessage("Some special characters may have been skipped due to the PowerEncoding.", "Warning", MessageBoxButton.OK); } hashBox.Text = CryptoRepository.CalculateHash( inputBox.Text, HashAlgorithm.Create((hashComboBox.SelectedValue as ComboBoxItem).Content.ToString()), (bool)base64RadioButton.IsChecked); }
private void decodeButton_Click(object sender, RoutedEventArgs e) { PowerEncoding powerEncoding = new PowerEncoding(); try { resultBox.Text = powerEncoding.Decode(inputBox.Text); hashBox.Text = CryptoRepository.CalculateHash( resultBox.Text, HashAlgorithm.Create((hashComboBox.SelectedValue as ComboBoxItem).Content.ToString()), (bool)base64RadioButton.IsChecked); } catch (Exception ex) { ModernDialog.ShowMessage(ex.Message, "Error", MessageBoxButton.OK); } }