关闭

一种加密算法

标签: 加密算法exceptionbyteobjectsystem
740人阅读 评论(0) 收藏 举报

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Nutqq;

namespace QQencrypt
{
    public partial class Form1 : Form
    {
        private Crypter QQCrypter = new Crypter();
        public Form1()
        {
            InitializeComponent();
        }

        private void buttonEncrypt_Click(object sender, EventArgs e)
        {
            try
            {
                byte[] source = ASCIIEncoding.ASCII.GetBytes(textBoxSource.Text);
                byte[] key = ASCIIEncoding.ASCII.GetBytes(textBoxKey.Text);
                byte[] Encrypt = QQCrypter.encrypt(source, key);
                textBoxEncrypt.Text = ASCIIEncoding.ASCII.GetString(Encrypt);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }           
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void buttonDecrypt_Click(object sender, EventArgs e)
        {
           
            try
            {
                byte[] Encrypt = ASCIIEncoding.ASCII.GetBytes(textBoxEncrypt.Text);
                byte[] Decrypt = QQCrypter.decrypt(Encrypt,ASCIIEncoding.ASCII.GetBytes(textBoxKey.Text));
                textBoxDecrypt.Text = ASCIIEncoding.ASCII.GetString(Decrypt);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
          
        }
    }

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:107910次
    • 积分:1381
    • 等级:
    • 排名:千里之外
    • 原创:32篇
    • 转载:4篇
    • 译文:0篇
    • 评论:4条
    文章分类
    最新评论