求一份C#文件移位加密与解密的程序!!!!! 谢谢 15
1个回答
展开全部
using System.Security.Cryptography;
using System.Text;
string get6(string 要加密的文字或者要解密的文字outXMLFilePath, string jia)
{
byte[] Keys =;
if (jia.Equals("加密"))
{
byte[] rgbKey =;
byte[] rgbIV = ;
byte[] inputByteArray = Encoding.UTF8.GetBytes(outXMLFilePath);
DESCryptoServiceProvider dCSP = new DESCryptoServiceProvider();
MemoryStream mStream = new MemoryStream();
CryptoStream cStream = new CryptoStream(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
cStream.Write(inputByteArray, 0, inputByteArray.Length);
cStream.FlushFinalBlock();
return Convert.ToBase64String(mStream.ToArray());
}
else
{
byte[] rgbKey =;
byte[] rgbIV = ;
byte[] inputByteArray = Convert.FromBase64String(outXMLFilePath);
DESCryptoServiceProvider DCSP = new DESCryptoServiceProvider();
MemoryStream mStream = new MemoryStream();
CryptoStream cStream = new CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
cStream.Write(inputByteArray, 0, inputByteArray.Length);
cStream.FlushFinalBlock();
return Encoding.UTF8.GetString(mStream.ToArray());
}
}
using System.Text;
string get6(string 要加密的文字或者要解密的文字outXMLFilePath, string jia)
{
byte[] Keys =;
if (jia.Equals("加密"))
{
byte[] rgbKey =;
byte[] rgbIV = ;
byte[] inputByteArray = Encoding.UTF8.GetBytes(outXMLFilePath);
DESCryptoServiceProvider dCSP = new DESCryptoServiceProvider();
MemoryStream mStream = new MemoryStream();
CryptoStream cStream = new CryptoStream(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
cStream.Write(inputByteArray, 0, inputByteArray.Length);
cStream.FlushFinalBlock();
return Convert.ToBase64String(mStream.ToArray());
}
else
{
byte[] rgbKey =;
byte[] rgbIV = ;
byte[] inputByteArray = Convert.FromBase64String(outXMLFilePath);
DESCryptoServiceProvider DCSP = new DESCryptoServiceProvider();
MemoryStream mStream = new MemoryStream();
CryptoStream cStream = new CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
cStream.Write(inputByteArray, 0, inputByteArray.Length);
cStream.FlushFinalBlock();
return Encoding.UTF8.GetString(mStream.ToArray());
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询