could you tell me what's your mean
解决方案 »
- 为什么我的textbook获取不到值?
- 导出数据到excel如何保持内容在单元格内的换行
- 页面打印预览
- C#中如何将导入的位图重画然后生成PNG格式的位图输出
- 用时半个月完成的小软件,免费提供给大家使用
- 使用ASP.NET 和ORACLE数据库编写程序
- 救急啊!服务器上操作excel文件的问题!!!!!!!!!!!
- 动态网页问题
- B/S系统能否现实类似注册码功能?限制用户的发布量!
- 更换帐号,转分贴,勿回!
- nhibernate开发程序里新添加的表出现in expected: keFuEvent [select keFuEvent from KeFuEvent keFuEvent order by keFuEvent.Id desc]
- img onclick 代替 button_click的效果?
{
public Encryption()
{
} /// <summary>
/// 对字符串进行加密。
/// </summary>
/// <param name="src">要加密的字符串。 </param>
/// <returns>返回加密后的字符串。 </returns>
public static string Encrypt(string src)
{
if (src == "") return src; Encoding enc = Encoding.Unicode;
byte [] input = enc.GetBytes(src);
byte [] output = Encryption.Encrypt(input); string result = System.Convert.ToBase64String(output);
return result;
} /// <summary>
/// 对字节数组进行加密。
/// </summary>
/// <param name="input">要加密的字节数组。 </param>
/// <returns>返回加密后的字节数组。 </returns>
public static byte [] Encrypt(byte[] input)
{
byte[] key = {0x13, 0x90, 0x11, 0x99, 0x93, 0x13, 0x80, 0x12};
byte[] iv = {0x08, 0x01, 0x41, 0x39, 0x01, 0x19, 0x99, 0x31}; DESCryptoServiceProvider desp = new DESCryptoServiceProvider();
ICryptoTransform enf = desp.CreateEncryptor(key, iv); byte [] output = enf.TransformFinalBlock(input, 0, input.Length); return output;
} /// <summary>
/// 对字节数组进行解密。
/// </summary>
/// <param name="input">要解密的字节数组。 </param>
/// <returns>返回解密后的字节数组。 </returns>
public static byte [] Decrypt(byte[] input)
{
byte[] key = {0x13, 0x90, 0x11, 0x99, 0x93, 0x13, 0x80, 0x12};
byte[] iv = {0x08, 0x01, 0x41, 0x39, 0x01, 0x19, 0x99, 0x31}; DESCryptoServiceProvider desp = new DESCryptoServiceProvider();
ICryptoTransform enf = desp.CreateDecryptor(key, iv); byte [] output = enf.TransformFinalBlock(input, 0, input.Length); return output;
} /// <summary>
/// 对字符串进行解密。
/// </summary>
/// <param name="src">要解密的字符串。 </param>
/// <returns>返回解密后的字符串。 </returns>
public static string Decrypt(string src)
{
if (src == "") return src; Encoding enc = Encoding.Unicode; byte [] input = System.Convert.FromBase64String(src);
byte [] output = Encryption.Decrypt(input); string result = enc.GetString(output);
return result;
}
}
}