您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->Acom进出仓管理系统源码>>Components/PblogDes.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Acom进出仓管理系统源码


当前文件路径:AcomStore/Components/PblogDes.cs 文件类型
普通视图
		            
1////////////////////////////////////////////////////////////////////////// 2// 创建人:Pconcool Liu-per@163.com 3// 创建日期: 2007-09-16 4// 描述: 5// 6// 修改日志: 7// 8// 版权:Http://www.Pconcool.com(c)2007-2010 9////////////////////////////////////////////////////////////////////////// 10 11using System; 12using System.IO; 13using System.Security.Cryptography; 14using System.Text; 15 16namespace AcomLb.Components 17{ 18 19 public class PblogDes 20 { 21 private string key; 22 23 public PblogDes() 24 { 25 this.key = "PblogKey"; 26 } 27 28 public PblogDes(string key) 29 { 30 this.key = key; 31 } 32 33 public string Decrypt(string s) 34 { 35 return this.Decrypt(s, this.key); 36 } 37 38 private string Decrypt(string pToDecrypt, string sKey) 39 { 40 DESCryptoServiceProvider provider = new DESCryptoServiceProvider(); 41 byte[] buffer = new byte[pToDecrypt.Length / 2]; 42 for (int i = 0; i < (pToDecrypt.Length / 2); i++) 43 { 44 int num2 = Convert.ToInt32(pToDecrypt.Substring(i * 2, 2), 0x10); 45 buffer[i] = (byte)num2; 46 } 47 provider.Key = Encoding.ASCII.GetBytes(sKey); 48 provider.IV = Encoding.ASCII.GetBytes(sKey); 49 MemoryStream stream = new MemoryStream(); 50 CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(), CryptoStreamMode.Write); 51 stream2.Write(buffer, 0, buffer.Length); 52 stream2.FlushFinalBlock(); 53 new StringBuilder(); 54 return Encoding.Default.GetString(stream.ToArray()); 55 } 56 57 public string Encrypt(string s) 58 { 59 return this.Encrypt(s, this.key); 60 } 61 62 private string Encrypt(string pToEncrypt, string sKey) 63 { 64 DESCryptoServiceProvider provider = new DESCryptoServiceProvider(); 65 byte[] bytes = Encoding.Default.GetBytes(pToEncrypt); 66 provider.Key = Encoding.ASCII.GetBytes(sKey); 67 provider.IV = Encoding.ASCII.GetBytes(sKey); 68 MemoryStream stream = new MemoryStream(); 69 CryptoStream stream2 = new CryptoStream(stream, provider.CreateEncryptor(), CryptoStreamMode.Write); 70 stream2.Write(bytes, 0, bytes.Length); 71 stream2.FlushFinalBlock(); 72 StringBuilder builder = new StringBuilder(); 73 foreach (byte num in stream.ToArray()) 74 { 75 builder.AppendFormat("{0:X2}", num); 76 } 77 builder.ToString(); 78 return builder.ToString(); 79 } 80 } 81} 82
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Acom进出仓管理系统源码

- BlogYi v1.6.5项目源文件

- 荒野新闻系统Access最终开源版

- AfengPager通用URL分页源码及..

- 《用实例学ASP.NET》随书源码

- 某大学学生管理系统(毕业设..

- 小爱学习(asp.Net)新闻系统 V0.1

- Asp.net客户跟踪管理系统(CRM)

- 智能选课系统源码及论坛

51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号