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
相关文档:
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 ......
事件与委托似乎很难以理解,这是因为它们的使用方式与常用的编码有很大的差别,例如通常编写的都是同步代码,调用一个类型的方法,会即刻出现方法执
行的结果,这是符合逻辑的。但在某些情况中,同步代码未必满足需求,拿公共汽车来打个比方,如果交通管制中心希望每一辆公车到达一个站点时都发送给自己一
个信号以便自己 ......
public enum GUIInfoType
{
guiText.
guiTextClass,
guiTextParent,
guiTextClassParent,
}
private static int level=0
public static int FindGUILike(ref int hWndArray,int hWndStart,ref string window ......
今天看了我的老师钟声的书《Java程序员上班那点儿事》,其中有一段关于Java实现动态编译的代码使我很受启发,决定在.NET中尝试一下。
引入下列命名空间:
using System.CodeDom;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
C#代码:
&n ......