DataCode/Encryption.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Text;
using System.Security.Cryptography;
/// <summary>
/// 提供常用的数据加密和解密的方法。
/// </summary>
public class Encryption
{
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 = { 0x15, 0x90, 0x11, 0x99, 0x93, 0x13, 0x80, 0x12 };
byte[] iv = { 0x04, 0x01, 0x41, 0x39, 0x01, 0x22, 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 = { 0x15, 0x90, 0x11, 0x99, 0x93, 0x13, 0x80, 0x12 };
byte[] iv = { 0x04, 0x01, 0x41, 0x39, 0x01, 0x22, 0x99, 0x31 };
DESCryptoServiceProvider desp = new DESCryptoServiceProvider();
ICryptoTransform enf = desp.CreateDecryptor(key, iv);
后面还有 24 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
