本帖最后由 浪漫黑客 于 2020-6-8 19:06 编辑
求字符串DES解密方法 key已经找到但是解密不了 是不是我哪里弄错了
加密后字符串
Ub0BrU4gGkrY/Pdz2N1PgPf0hlIO1r7Z87cfndguNSA=
key
private static string sKey = "ENCRYPTBOO";
下面提供下 代码 知道的朋友给指教下
https://pan.baidu.com/s/1CCOFSI-lyrTZ5IPw6vsSgw 密码 g2ki 这个免币 之前有扣币下载的我会多倍补回 谢谢大家帮忙
这里是生成的字符串
[C#] 纯文本查看 复制代码 public static string LiveSource
{
get
{
return TriDESEncrypt.Decrypt("Ub0BrU4gGkrY/Pdz2N1PgPf0hlIO1r7Z87cfndguNSA=");
}
}
下面是 TriDESEncrypt skey
[C#] 纯文本查看 复制代码 using System;
using System.Security.Cryptography;
using System.Text;
namespace Debiao.WebUtils
{
public class TriDESEncrypt
{
private static string sKey = "ENCRYPTBOO";
public static string Encrypt(string original)
{
return TriDESEncrypt.Encrypt(original, TriDESEncrypt.sKey);
}
public static string Decrypt(string original)
{
return TriDESEncrypt.Decrypt(original, TriDESEncrypt.sKey, System.Text.Encoding.Default);
}
public static string Decrypt(string original, string key)
{
return TriDESEncrypt.Decrypt(original, key, System.Text.Encoding.Default);
}
public static string Decrypt(string original, System.Text.Encoding encoding)
{
return TriDESEncrypt.Decrypt(original, TriDESEncrypt.sKey, encoding);
}
public static string Encrypt(string original, string key)
{
string result;
try
{
byte[] bytes = System.Text.Encoding.Default.GetBytes(original);
byte[] bytes2 = System.Text.Encoding.Default.GetBytes(key);
result = System.Convert.ToBase64String(TriDESEncrypt.Encrypt(bytes, bytes2));
}
catch
{
result = "";
}
return result;
}
public static string Decrypt(string encrypted, string key, System.Text.Encoding encoding)
{
string result;
try
{
byte[] encrypted2 = System.Convert.FromBase64String(encrypted);
byte[] bytes = System.Text.Encoding.Default.GetBytes(key);
result = encoding.GetString(TriDESEncrypt.Decrypt(encrypted2, bytes));
}
catch
{
result = "";
}
return result;
}
public static byte[] MakeMD5(byte[] original)
{
System.Security.Cryptography.MD5CryptoServiceProvider mD5CryptoServiceProvider = new System.Security.Cryptography.MD5CryptoServiceProvider();
return mD5CryptoServiceProvider.ComputeHash(original);
}
public static byte[] Encrypt(byte[] original, byte[] key)
{
return new System.Security.Cryptography.TripleDESCryptoServiceProvider
{
Key = TriDESEncrypt.MakeMD5(key),
Mode = System.Security.Cryptography.CipherMode.ECB
}.CreateEncryptor().TransformFinalBlock(original, 0, original.Length);
}
public static byte[] Decrypt(byte[] encrypted, byte[] key)
{
return new System.Security.Cryptography.TripleDESCryptoServiceProvider
{
Key = TriDESEncrypt.MakeMD5(key),
Mode = System.Security.Cryptography.CipherMode.ECB
}.CreateDecryptor().TransformFinalBlock(encrypted, 0, encrypted.Length);
}
public static byte[] Encrypt(byte[] original)
{
byte[] bytes = System.Text.Encoding.Default.GetBytes(TriDESEncrypt.sKey);
return TriDESEncrypt.Encrypt(original, bytes);
}
public static byte[] Decrypt(byte[] encrypted)
{
byte[] bytes = System.Text.Encoding.Default.GetBytes(TriDESEncrypt.sKey);
return TriDESEncrypt.Decrypt(encrypted, bytes);
}
}
}
我已经发悬赏区 如果大家会的 帮个忙地址 https://www.52pojie.cn/thread-1196156-1-1.html |