DES加密问题

好大一地嗯 2009-07-13 01:31:14
有一个文件,串被加密了,用以下代码解密:
现在我有下面的代码:
Stream stream = new FileStream("***.lic", FileMode.Open, FileAccess.Read, FileShare.Read);
Stream write = new StreamWriter(stream);
BinaryReader reader = new BinaryReader(stream);
BinaryWriter binaryWriter = new BinaryWriter(write);
this.textBox1.AppendText(Convert.ToString(reader.ReadDouble()));

reader.ReadBytes(0x7b);
int count = reader.ReadInt32();
byte[] buffer = reader.ReadBytes(count);
MemoryStream stream2 = new MemoryStream(buffer);
ICryptoTransform transform = new DESCryptoServiceProvider { Key = staticbytee(), IV = staticbytee() }.CreateDecryptor();
Stream stream3 = new CryptoStream(stream2, transform, CryptoStreamMode.Read);
this.textBox1.AppendText(new StreamReader(stream3, Encoding.UTF8).ReadToEnd());
reader.ReadBytes(0xea);
int num3 = reader.ReadInt32();
byte[] buffer2 = reader.ReadBytes(num3);
stream2 = new MemoryStream(buffer);
stream3 = new CryptoStream(stream2, transform, CryptoStreamMode.Read);
this.textBox1.AppendText(new StreamReader(stream3, Encoding.UTF8).ReadToEnd());


密钥:
staticbytee:
private static byte[] staticbytee()
{

byte[] staticb = new byte[] { 70, 0x35, 50, 0x42, 0x31, 0x38, 0x36, 70 };

return (byte[])staticb.Clone();
}


我怎样能在解密后修改了串再加密回去?
付说明:现在我加密得到的是120位,上面代码第一次读到是136位,第二次是128位,解密后的串是127位
...全文
35 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
好大一地嗯 2009-07-17
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 cgabriel 的回复:]
引用 2 楼 xinyu_hong 的回复:
我127位串加密出来怎么编程120了?不是应该是128吧?


虽然很神奇, 建议你去试试解那个 120, 要是能够成功解密,并且对得上原文....
[/Quote]

解密是没有问题的,问题是,我这个是反编译出来的,原程序没法改哦 ~~~~~~~~~
另:请教下各位,什么语言或开发工具支持类名与变量名相同的?
我反编译出来的source就是这样的,如果修改变量名,也太庞大了!!!
qizhicong2 2009-07-13
  • 打赏
  • 举报
回复
么解密就怎么加密呗,DES 是对称的。注意解密出来之后,把后面的冗余数据去掉
CGabriel 2009-07-13
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 xinyu_hong 的回复:]
我127位串加密出来怎么编程120了?不是应该是128吧?
[/Quote]

虽然很神奇, 建议你去试试解那个 120, 要是能够成功解密,并且对得上原文....
好大一地嗯 2009-07-13
  • 打赏
  • 举报
回复
我127位串加密出来怎么编程120了?不是应该是128吧?
CGabriel 2009-07-13
  • 打赏
  • 举报
回复
怎么解密就怎么加密呗,DES 是对称的。注意解密出来之后,把后面的冗余数据去掉

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧