求C#的异或算法加密解密程序
来源:百度知道 编辑:UC知道 时间:2024/05/25 09:01:50
using System;
using System.Text;
using System.Security.Cryptography;
using System.IO;
namespace Server
{
public class PWD
{
/// <summary>
/// 执行DES加密
/// </summary>
public static string DesEncrypt(string mge)
{
string str = "";
if (!string.IsNullOrEmpty(mge))
{
try
{
byte[] MyStr_E = Encoding.UTF8.GetBytes(mge);
byte[] MyKey_E = Encoding.UTF8.GetBytes("*&^%$#@!");
DESCryptoServiceProvider MyDes_E = new DESCryptoServiceProvider();
MyDes_E.Key = MyKey_E;
MyDes_E.IV = MyKey_E;
MemoryStream MyMem_E = new MemoryStream();
CryptoStream MyCry_E = new CryptoStre