您目前尚未登陆,请选择【登陆】或【注册
首页->其他源码->内文广告管理系统V1.1版源码>>App-Code/Tools.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:内文广告管理系统V1.1版源码
当前文件:文件类型 TextAd/App_Code/Tools.cs打开代码结构图
普通视图
		            
1using System; 2using System.Text; 3using System.IO; 4using System.Web.UI; 5using System.Web.UI.WebControls; 6using System.Data.OleDb; 7using System.Data; 8using System.Web; 9using System.Collections.Generic; 10using System.Security.Cryptography; 11 12//该源码下载自www.a s p x 1.com(51aspx.com) 13//工具类 14public class Tools 15{ 16 public Tools() 17 { 18 } 19 // 得到加密字符串 20 //strText:要加密字符串;strEncrKey:密钥;返回:加密后字符串 21 public static string Encrypt(string strText, string strEncrKey)//加密函数 22 { 23 byte[] byKey = null;//初始化密钥 24 byte[] IV = { 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF, 0x11, 0x12 }; 25 try 26 { 27 byKey = System.Text.Encoding.UTF8.GetBytes(strEncrKey);//获取密钥 28 DESCryptoServiceProvider des = new DESCryptoServiceProvider(); 29 byte[] inputByteArray = Encoding.UTF8.GetBytes(strText);//输入的字符串转化成字节型 30 MemoryStream ms = new MemoryStream(); 31 CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write); 32 cs.Write(inputByteArray, 0, inputByteArray.Length);//输出加密流 33 cs.FlushFinalBlock(); 34 return Convert.ToBase64String(ms.ToArray()); 35 } 36 catch (System.Exception error) 37 { 38 return "error:" + error.Message + "\r"; 39 } 40 } 41} 42
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:内文广告管理系统V1.1版源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号