private void Fix_Button_Click(object sender, RoutedEventArgs e) { if (txtDesKeyIn.Text.Length != 16) { MessageBox.Show("Invalid key length", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } List <byte> key = new List <byte>(); try { key = Utility.ByteStringToByteList(txtDesKeyIn.Text); } catch (Exception) { MessageBox.Show("Error Parsing Key", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } byte[] outArrKey = null; try { outArrKey = KeyGenerator.FixupKeyParity(key.ToArray()); } catch (Exception) { MessageBox.Show("Error Fixing Key", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } txtDesKeyOut.Text = BitConverter.ToString(outArrKey).Replace("-", string.Empty); }