Winform中使用異或算法對數字進行加密解密 算法
場景
使用異或算法進行數字加密效果編程
注:ide
博客主頁:
https://blog.csdn.net/badao_liumang_qizhi
關注公衆號
霸道的程序猿
獲取編程相關電子書、教程推送與免費下載。佈局
新建一個Winform程序,設計窗體頁面佈局以下加密
而後須要添加的引用以下spa
修改其代碼爲.net
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace YHEnData { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { if (textBox1.Text != "") { textBox2.Text = (Convert.ToInt32(textBox1.Text) ^ 123).ToString(); } } catch { } } private void button2_Click(object sender, EventArgs e) { try { if (textBox2.Text != "") { textBox1.Text = (Convert.ToInt32(textBox2.Text) ^ 123).ToString(); } } catch { } } } }