c#程序解释

[复制链接]
查看11 | 回复3 | 2010-12-12 23:24:58 | 显示全部楼层 |阅读模式
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 加密
{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void label1_Click(object sender, EventArgs e)

{

}

private void button1_Click(object sender, EventArgs e)

{

string a = this.textBox1.Text;

int L = this.textBox1.Text.Length;

char[] shuzu = new char[L];

string yan = "";

shuzu = a.ToCharArray();

for (int i = 0; i < L; i++)

{

int n = Convert.ToInt32(shuzu);

n = (n+3) % 26;

shuzu = Convert.ToChar(n);

yan = shuzu.ToString();

}

this.textBox2.Text = yan;

}

private void button2_Click_1(object sender, EventArgs e)

{

string a = this.textBox2.Text;

int l =this.textBox2.Text.Length;

char[] shuzu= new char[l];

string yan = "";

shuzu= a.ToCharArray();

for (int i = 0; i < l; i++)

{

int n = Convert.ToInt16(shuzu);

n = (n - 3) % 26;

shuzu = Convert.ToChar(n);

yan =shuzu.ToString();

}

this.textBox3.Text = yan;

}

private void button3_Click(object sender, EventArgs e)

{

this.textBox1.Text = "";

}

}
}
解释一下这是数字签名还是其他加密的实现
这个问题是能解释一下是加密中的置换是不

回复

使用道具 举报

千问 | 2010-12-12 23:24:58 | 显示全部楼层
我做了实验 不是最后的字母赋值,而是通过button_click事件中的那段for循环将最后的一个字母改写了,然后才赋给另外的一个textbox。button3是将textbox清空!
回复

使用道具 举报

千问 | 2010-12-12 23:24:58 | 显示全部楼层
为完成任务来的
回复

使用道具 举报

千问 | 2010-12-12 23:24:58 | 显示全部楼层
button1 被点击时,依据textbox1输入的最后一个字母改写textbox2的值,button2 被点击时,依据textbox2输入的最后一个字母改写textbox3的值,button3 被点击时,设定textbox1的值为空,改写的规则很奇怪,肯定不是加密,因为它没法还原。说是数字签名也很勉强,因为它重复得太厉害了。abc, abc
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行