28
2015
06

【C#、Asp.Net 工具类大全】加密解密工具类

使用实例:

private string urlPath = "";

protected void Page_Load(object sender, EventArgs e)

{

    if (!Page.IsPostBack)

    { 

        urlPath = Server.MapPath("~/file/");

        encryptInfo();

    }

}

/// <summary>

/// 字符串加密解密

/// </summary>

11
2013
03

标准的DES加密、解密类

   public class CryptoUtil

   {

       //随机选8个字节既为密钥也为初始向量

       private static byte[] KEY_64 = { 42, 16, 93, 156, 78, 4, 218, 32 };

       private static byte[] IV_64 = { 55, 103, 246, 79, 36, 99, 167, 3 };

12
2012
04

C# 加密算法的方法,解密算法的方法

//加密算法的方法
const string KEY_64 = "VavicApp";//注意了,是8个字符,64位
const string IV_64 = "VavicApp";
public string Encode(string data)
{
byte[] byKey = System.Text.ASCIIEncoding.ASCII.GetBytes(KEY_64);
byte[] byIV = System.Text.ASCIIEncoding.ASCII.GetBytes(IV_64);
...
27
2012
03

简单数据加密、解密

直接贴上代码:
using System.Security.Cryptography;
using System.IO;
//加密
public static string Encrypt(string strText)
{
string strEncrKey = "code 's key ";
Byte[] byKey = { };
Byte[] IV = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
...
«1»