python转换成c#
答案:1 悬赏:0 手机版
解决时间 2021-11-27 22:13
- 提问者网友:姑娘长的好罪过
- 2021-11-27 03:22
python转换成c#
最佳答案
- 五星知识达人网友:从此江山别
- 2021-11-27 03:33
using System.Security.Cryptography;public string Decrypt(string pToDecrypt, string sKey)
{
byte[] inputByteArray = Convert.FromBase64String(pToDecrypt);
using (DESCryptoServiceProvider des = new DESCryptoServiceProvider())
{
des.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
des.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
using (CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write))
{
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
cs.Close();
}
string str = Encoding.UTF8.GetString(ms.ToArray());
ms.Close();
return str;
}
}byte[] byData = new byte[100000];
char[] charData = new char[1000000];
try
{
FileStream sFile = new FileStream("config.bin",FileMode.Open);
sFile.Read(byData, 0, 100);
}
catch (IOException e)
{
return;
}
String result=Decruypt(byData.ToString(), "xE3xA5xE3xA5xE3xA5xE3xA5")
{
byte[] inputByteArray = Convert.FromBase64String(pToDecrypt);
using (DESCryptoServiceProvider des = new DESCryptoServiceProvider())
{
des.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
des.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
using (CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write))
{
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
cs.Close();
}
string str = Encoding.UTF8.GetString(ms.ToArray());
ms.Close();
return str;
}
}byte[] byData = new byte[100000];
char[] charData = new char[1000000];
try
{
FileStream sFile = new FileStream("config.bin",FileMode.Open);
sFile.Read(byData, 0, 100);
}
catch (IOException e)
{
return;
}
String result=Decruypt(byData.ToString(), "xE3xA5xE3xA5xE3xA5xE3xA5")
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯