欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#利用異或算法實(shí)現(xiàn)加密解密

 更新時間:2023年01月03日 09:32:27   作者:芝麻粒兒  
這篇文章主要為大家詳細(xì)介紹了C#如何利用異或算法實(shí)現(xiàn)加密解密的功能,文中的示例代碼講解詳細(xì),對我們學(xué)習(xí)C#有一定的幫助,感興趣的小伙伴可以跟隨小編一起了解一下

實(shí)踐過程

效果

代碼

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 { }
    }
}
partial class Form1
{
    /// <summary>
    /// 必需的設(shè)計(jì)器變量。
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// 清理所有正在使用的資源。
    /// </summary>
    /// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows 窗體設(shè)計(jì)器生成的代碼

    /// <summary>
    /// 設(shè)計(jì)器支持所需的方法 - 不要
    /// 使用代碼編輯器修改此方法的內(nèi)容。
    /// </summary>
    private void InitializeComponent()
    {
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.textBox2 = new System.Windows.Forms.TextBox();
        this.label3 = new System.Windows.Forms.Label();
        this.button2 = new System.Windows.Forms.Button();
        this.button1 = new System.Windows.Forms.Button();
        this.textBox1 = new System.Windows.Forms.TextBox();
        this.label2 = new System.Windows.Forms.Label();
        this.groupBox1.SuspendLayout();
        this.SuspendLayout();
        // 
        // groupBox1
        // 
        this.groupBox1.Controls.Add(this.textBox2);
        this.groupBox1.Controls.Add(this.label3);
        this.groupBox1.Controls.Add(this.button2);
        this.groupBox1.Controls.Add(this.button1);
        this.groupBox1.Controls.Add(this.textBox1);
        this.groupBox1.Controls.Add(this.label2);
        this.groupBox1.Location = new System.Drawing.Point(6, 4);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Size = new System.Drawing.Size(282, 112);
        this.groupBox1.TabIndex = 6;
        this.groupBox1.TabStop = false;
        this.groupBox1.Text = "加密設(shè)置";
        // 
        // textBox2
        // 
        this.textBox2.Location = new System.Drawing.Point(115, 49);
        this.textBox2.Name = "textBox2";
        this.textBox2.Size = new System.Drawing.Size(143, 21);
        this.textBox2.TabIndex = 6;
        // 
        // label3
        // 
        this.label3.AutoSize = true;
        this.label3.Location = new System.Drawing.Point(24, 52);
        this.label3.Name = "label3";
        this.label3.Size = new System.Drawing.Size(89, 12);
        this.label3.TabIndex = 7;
        this.label3.Text = "加密后的數(shù)字:";
        // 
        // button2
        // 
        this.button2.Location = new System.Drawing.Point(183, 76);
        this.button2.Name = "button2";
        this.button2.Size = new System.Drawing.Size(75, 25);
        this.button2.TabIndex = 3;
        this.button2.Text = "解密";
        this.button2.UseVisualStyleBackColor = true;
        this.button2.Click += new System.EventHandler(this.button2_Click);
        // 
        // button1
        // 
        this.button1.Location = new System.Drawing.Point(101, 76);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(75, 25);
        this.button1.TabIndex = 2;
        this.button1.Text = "加密";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new System.EventHandler(this.button1_Click);
        // 
        // textBox1
        // 
        this.textBox1.Location = new System.Drawing.Point(115, 19);
        this.textBox1.Name = "textBox1";
        this.textBox1.Size = new System.Drawing.Size(143, 21);
        this.textBox1.TabIndex = 1;
        // 
        // label2
        // 
        this.label2.AutoSize = true;
        this.label2.Location = new System.Drawing.Point(24, 22);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(89, 12);
        this.label2.TabIndex = 5;
        this.label2.Text = "加密前的數(shù)字:";
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(296, 123);
        this.Controls.Add(this.groupBox1);
        this.MaximizeBox = false;
        this.MinimizeBox = false;
        this.Name = "Form1";
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.Text = "使用異或算法對數(shù)字進(jìn)行加密解密";
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.Button button2;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TextBox textBox2;
    private System.Windows.Forms.Label label3;
}

到此這篇關(guān)于C#利用異或算法實(shí)現(xiàn)加密解密的文章就介紹到這了,更多相關(guān)C#加密解密內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • C#9.0新特性詳解——頂級程序語句(Top-Level Programs)

    C#9.0新特性詳解——頂級程序語句(Top-Level Programs)

    這篇文章主要介紹了C#9.0新特性詳解——頂級程序語句(Top-Level Programs)的相關(guān)資料,幫助大家更好的理解和學(xué)習(xí)c#,感興趣的朋友可以了解下
    2020-12-12
  • c# WinForm制作圖片編輯工具(圖像拖動、縮放、旋轉(zhuǎn)、摳圖)

    c# WinForm制作圖片編輯工具(圖像拖動、縮放、旋轉(zhuǎn)、摳圖)

    這篇文章主要介紹了c# WinForm制作圖片編輯工具(可實(shí)現(xiàn)圖像拖動、縮放、旋轉(zhuǎn)、摳圖),幫助大家更好的理解和學(xué)習(xí)使用c#,感興趣的朋友可以了解下
    2021-03-03
  • C# PadLeft、PadRight用法詳解

    C# PadLeft、PadRight用法詳解

    本文主要介紹了C# PadLeft、PadRight用法詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-02-02
  • c# 獲得當(dāng)前絕對路徑的方法(超簡單)

    c# 獲得當(dāng)前絕對路徑的方法(超簡單)

    下面小編就為大家分享一篇c# 獲得當(dāng)前絕對路徑的方法(超簡單),具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-01-01
  • 基于C#實(shí)現(xiàn)熱鍵注冊工具類

    基于C#實(shí)現(xiàn)熱鍵注冊工具類

    這篇文章主要為大家詳細(xì)介紹了一個驗(yàn)證過的熱鍵注冊工具類,使用系統(tǒng)類庫user32.dll中的RegisterHotkey函數(shù)來實(shí)現(xiàn)全局熱鍵的注冊,感興趣的小伙伴可以學(xué)習(xí)一下
    2023-12-12
  • C#如何自定義線性節(jié)點(diǎn)鏈表集合

    C#如何自定義線性節(jié)點(diǎn)鏈表集合

    C#如何自定義線性節(jié)點(diǎn)鏈表集合,這篇文章主要為大家詳細(xì)介紹了C#基于泛型的自定義線性節(jié)點(diǎn)鏈表集合示例,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-07-07
  • C#中多態(tài)、重載、重寫區(qū)別分析

    C#中多態(tài)、重載、重寫區(qū)別分析

    這篇文章主要介紹了C#中多態(tài)、重載、重寫區(qū)別,采用實(shí)例較為通俗易懂的分析了多態(tài)、重載的重寫的概念與用法,對于C#初學(xué)者有非常不錯的借鑒價(jià)值,需要的朋友可以參考下
    2014-09-09
  • C#遞歸應(yīng)用之實(shí)現(xiàn)JS文件的自動引用

    C#遞歸應(yīng)用之實(shí)現(xiàn)JS文件的自動引用

    這篇文章主要為大家詳細(xì)介紹了C#如何利用遞歸實(shí)現(xiàn)JS文件的自動引用的功能,文中的示例代碼講解詳細(xì),具有一定的參考價(jià)值,需要的可以參考一下
    2023-03-03
  • C#學(xué)習(xí)筆記之字符串常用方法

    C#學(xué)習(xí)筆記之字符串常用方法

    在C#中字符串是用于表示文本的一系列字符,它可以是字符、單詞 或用雙引號引起來的長段落,下面這篇文章主要給大家介紹了關(guān)于C#學(xué)習(xí)筆記之字符串常用方法的相關(guān)資料,需要的朋友可以參考下
    2024-01-01
  • .Net(c#)漢字和Unicode編碼互相轉(zhuǎn)換實(shí)例

    .Net(c#)漢字和Unicode編碼互相轉(zhuǎn)換實(shí)例

    下面小編就為大家?guī)硪黄?Net(c#)漢字和Unicode編碼互相轉(zhuǎn)換實(shí)例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-02-02

最新評論