求一个c#加密解密软件 要求有密钥 不用太复杂就OK了

来源:百度知道 编辑:UC知道 时间:2024/06/05 00:13:50
课程设计需要的 我们老师说 不用C#自带的DES - -!

要的话call 我,QQ:562632615.并且快速采纳我的回答,欢迎一起讨论C#有关编程问题

关键字:DES加密

using System.Web.Security;
using System.Security.Cryptography;
#region 密钥加密
/// <summary>
/// 得到加密字符串
/// </summary>
/// <param name="strText">要加密字符串</param>
/// <param name="strEncrKey">密钥</param>
/// <returns>加密后字符串</returns>
public string DesEncrypt(string strText, string strEncrKey)//加密函数
{
byte[] byKey=null;
byte[] IV= {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};
try
{
byKey = System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(0,strEncrKey.Length));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
byte[] inputByteArray = Encoding.UTF8.GetBytes(strText);
MemoryStream ms = new MemoryStream();
Cryp