首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎样让asp和.net中的md5兼容?该如何解决

2012-01-12 
怎样让asp和.net中的md5兼容?如题目,看过一些帖子,不过还是没解决在线等待![解决办法]//MD5.cs//MD5 16-bi

怎样让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;
}
[解决办法]
内容不都是一样的?只是格式不一样,格式成一样的不就得了

热点排行