从coldfusion验证用c#加密的密码
我需要解密(或以同样的方式加密原始密码,不管是什么最简单的方法)由Coldfusion中的用户定义函数用C#加密的密码。下面是使用的c#函数从coldfusion验证用c#加密的密码,c#,.net,coldfusion,C#,.net,Coldfusion,我需要解密(或以同样的方式加密原始密码,不管是什么最简单的方法)由Coldfusion中的用户定义函数用C#加密的密码。下面是使用的c#函数 private static byte[] key = { }; private static byte[] IV = { 38, 55, 206, 48, 28, 64, 20, 16 }; private static string stringKey = "xxxxxxxxxxxxxxxxxxxxxxxx"; public static strin
private static byte[] key = { };
private static byte[] IV = { 38, 55, 206, 48, 28, 64, 20, 16 };
private static string stringKey = "xxxxxxxxxxxxxxxxxxxxxxxx";
public static string Md5Encrypt(string password)
{
string empty = string.Empty;
string str;
try
{
Helpers.key = Encoding.UTF8.GetBytes(Helpers.stringKey.Substring(0, 8));
DESCryptoServiceProvider cryptoServiceProvider = new DESCryptoServiceProvider();
byte[] bytes = Encoding.UTF8.GetBytes(password.ToString());
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream((Stream) memoryStream, cryptoServiceProvider.CreateEncryptor(Helpers.key, Helpers.IV), CryptoStreamMode.Write);
cryptoStream.Write(bytes, 0, bytes.Length);
cryptoStream.FlushFinalBlock();
str = Convert.ToBase64String(memoryStream.ToArray()).Replace("+", "-").Replace("/", "_");
}
catch (Exception ex)
{
return "";
}
return str;
}
这个函数在ColdFusion中是什么样子的?它们使用什么?您面临的具体问题是什么?我需要验证coldfusion中通过此函数在c#中加密的密码。目前还没有coldfusion功能。好的,什么功能不起作用?密码永远不应该被加密。它们应该被散列。加密密码是一个巨大的负担,如果加密数据是由黑客或数据库管理员或开发人员获得的,则很容易解密。我同意@CarCar-说服负责人咬紧牙关,对密码进行散列,而不是加密。在ColdFusion中,该函数看起来像什么?它们使用什么?您面临的具体问题是什么?我需要验证coldfusion中通过此函数在c#中加密的密码。目前还没有coldfusion功能。好的,什么功能不起作用?密码永远不应该被加密。它们应该被散列。加密密码是一个巨大的负担,如果加密数据是由黑客或数据库管理员或开发人员获得的,则很容易解密。我同意@CarCar-说服负责人咬紧牙关,将密码散列,而不是加密密码。