BN089-BS开发框架MVC4版/source20131023/Zephyr.Net/Zephyr.Utils/Security/DES.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO;
using Zephyr.Utils;
namespace Zephyr.Utils
{
public partial class ZEncypt
{
/// <summary>
/// 32位Key值:
/// </summary>
private static byte[] DESKey = new byte[] { 0x03, 0x0B, 0x13, 0x1B, 0x23, 0x2B, 0x33, 0x3B, 0x43, 0x4B, 0x9B, 0x93, 0x8B, 0x83, 0x7B, 0x73, 0x6B, 0x63, 0x5B, 0x53, 0xF3, 0xFB, 0xA3, 0xAB, 0xB3, 0xBB, 0xC3, 0xEB, 0xE3, 0xDB, 0xD3, 0xCB };
#region DES加密
/// <summary>
/// DES加密
/// </summary>
/// <param name="strSource">待加密字串</param>
/// <returns>加密后的字符串</returns>
public static string DESEncrypt(string strSource)
{
return DESEncrypt(strSource, DESKey);
}
/// <summary>
/// DES加密
/// </summary>
/// <param name="strSource">待加密字串</param>
/// <param name="key">Key值</param>
/// <returns>加密后的字符串</returns>
public static string DESEncrypt(string strSource, byte[] key)
{
SymmetricAlgorithm sa = Rijndael.Create();
sa.Key = key;
sa.Mode = CipherMode.ECB;
sa.Padding = PaddingMode.Zeros;
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, sa.CreateEncryptor(), CryptoStreamMode.Write);
byte[] byt = Encoding.Unicode.GetBytes(strSource);
cs.Write(byt, 0, byt.Length);
cs.FlushFinalBlock();
cs.Close();
return Convert.ToBase64String(ms.ToArray());
}
#endregion
#region DES解密
/// <summary>
/// DES解密
/// </summary>
/// <param name="strSource">待解密的字串</param>
/// <returns>解密后的字符串</returns>
public static string DESDecrypt(string strSource)
{
return DESDecrypt(strSource, DESKey);
}
/// <summary>
/// DES解密
/// </summary>
后面还有 20 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
