日期:2014-05-20  浏览次数:21022 次

怎样让asp和.net中的md5兼容?
如题目,看过一些帖子,不过还是没解决

在线等待!

------解决方案--------------------
//MD5.cs
//MD5 16-bit,32-bits algorithm implemented in C#

using System;
using System.Text;

namespace EncryptMD5
{
/// <summary>
/// Summary description for MD5.
/// </summary>
public sealed class MD5
{
const int BITS_TO_A_BYTE = 8;
const int BYTES_TO_A_WORD = 4;
const int BITS_TO_A_WORD = 32;
private static long[] m_lOnBits = new long[30 + 1];
private static long[] m_l2Power = new long[30 + 1];

private static long LShift(long lValue, long iShiftBits)
{
long LShift = 0;
if (iShiftBits == 0)
{
LShift = lValue;
return LShift;
}
else
{
if( iShiftBits == 31)
{
if (Convert.ToBoolean(lValue & 1))
{
LShift = 0x80000000;
}
else
{
LShift = 0;
}
return LShift;
}
else
{
if( iShiftBits < 0 || iShiftBits > 31)
{
// Err.Raise 6;
}
}
}

if (Convert.ToBoolean((lValue & m_l2Power[31 - iShiftBits])))
{
LShift = ((lValue & m_lOnBits[31 - (iShiftBits + 1)]) * m_l2Power[iShiftBits]) | 0x80000000;
}
else
{
LShift = ((lValue & m_lOnBits[31 - iShiftBits]) * m_l2Power[iShiftBits]);
}

return LShift;
}
------解决方案--------------------
内容不都是一样的?只是格式不一样,格式成一样的不就得了