asp.net(C#)字符串加密
asp.net(C#)字符串加密
2010-03-12 09:59
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;//Cryptography密码术
namespace DAL
{
public class Encry
{
public Encry() { }
#region AES加密
public static string Encrypt(string toEncrypt)
{
byte[] keyArray = UTF8Encoding.UTF8.GetBytes("12345678901234567890123456789012");
byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt);
RijndaelManaged rDel = new RijndaelManaged();//using System.Security.Cryptography;
rDel.Key = keyArray;
rDel.Mode = CipherMode.ECB;//using System.Security.Cryptography;
rDel.Padding = PaddingMode.PKCS7;//using System.Security.Cryptography;
ICryptoTransform cTransform = rDel.CreateEncryptor();//using System.Security.Cryptography;
byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toE
相关文档:
C#正则表达式编程(三):Match类和Group类用法 收藏 此文于2010-03-09被推荐到CSDN首页
如何被推荐?
前面两篇讲述了正则表达式的基础和一些简单的例子,这篇将稍微深入一点探讨一下正则表达式分组,在.NET中正则表达式分组是用Math类来代表的。
首先先看一段代码:
view plaincopy to clipboardprint?
/// &l ......
server:
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,ProtocolType.Udp);
IPEndPoint iep1 = new IPEndPoint(IPAddress.Broadcast, 9050);//255.255.255.255
IPEndPoint iep2 = new IPEndPoint(IPAddress.Parse("192.168.1.255"), 9050);
......
在net中有一个至关重要的关键字,那就是using
using一般有着以下几种用法:
1、直接引入命名空间
a、using System ,这个是最常用的,就是using+命名空间,这样就可以直接使用命名空间中的类型,而免去了使用详细的命名空间
b、使用全限定名
不用使用using System;直接在程序中调用System.Console.WriteLine("Hello ......
事件与委托似乎很难以理解,这是因为它们的使用方式与常用的编码有很大的差别,例如通常编写的都是同步代码,调用一个类型的方法,会即刻出现方法执
行的结果,这是符合逻辑的。但在某些情况中,同步代码未必满足需求,拿公共汽车来打个比方,如果交通管制中心希望每一辆公车到达一个站点时都发送给自己一
个信号以便自己 ......
最近在忙于 将租赁管理系统mssql数据库转移至firebird数据 以减少成本负担 这个常见问题解决方案留给大家 有更好的或者撇砖块的来着不拒 呵呵
MS-sql在通常 C#代码里 我们提交一个查询字符串 只需如: string sql=" select id 编号,[name] 姓名,sex 性别 from users";
提交即可返回table
但是在 firebird在字段 命名或者 ......