Beispiel #1
0
 private void btnMD5Crypt_Click(object sender, EventArgs e)
 {
     try
     {
         tbxMD5Crypted.Text = "";
         string pass = CryptUtil.MD5Crypt(tbxMD5Origin.Text, GetMD5CrypType(), tbxMDSalt.Text, radioGroup1.SelectedIndex, getEncoding(cbxMD5Charset));
         tbxMD5Crypted.Text = pass;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         tbxSHACrypted.Text = "";
         string txt  = tbxSHAOrigin.Text;
         string salt = tbxSHASalt.Text;
         string pass = CryptUtil.SHAEncrypt(txt, salt, getShaType(), getEncoding(cbxSHACharset));
         tbxSHACrypted.Text = pass;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #3
0
 private void tbxBaseDecrypt_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(tbxBaseCrypted.Text))
         {
             throw new Exception("密文必须填写!");
         }
         string txt = CryptUtil.Base64Decrypt(tbxBaseCrypted.Text, getEncoding(cbxBaseCharset));
         tbxBaseOrigin.Text = txt;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #4
0
 private void tbxBaseEncrypt_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(tbxBaseOrigin.Text))
         {
             throw new Exception("原文必须填写!");
         }
         tbxBaseCrypted.Text = "";
         string pass = CryptUtil.Base64Encrypt(tbxBaseOrigin.Text, getEncoding(cbxBaseCharset), chkBaseOption.Checked ? Base64FormattingOptions.InsertLineBreaks : Base64FormattingOptions.None);
         tbxBaseCrypted.Text = pass;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #5
0
 private void button5_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(tbxDESCrypted.Text))
         {
             throw new Exception("密文不能为空!");
         }
         tbxDESOrigin.Text = "";
         string org = CryptUtil.DESDecrypt(tbxDESCrypted.Text, tbxDESKey.Text, tbxDESKeyIV.Text, cbxDESMode.Text, cbxDESPadding.Text, getEncoding(cbxDESCharset));
         tbxDESOrigin.Text = org;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }