代码
public string dvbbsPasswordEncrypt(string Password)
{
byte[] data=ConvertUTF8ToGB2312 (Password );
MD5 md5 = MD5.Create();
data=md5.ComputeHash(data);
string ret = string.Empty;
data.ToList().ForEach(it => ret += it.ToString("x"));
return ret.Substring(8, 16);
}
public byte[] ConvertUTF8ToGB2312(string pwd)
{
byte[] data = Encoding.UTF8.GetBytes(pwd);
data = Encoding.Convert(Encoding.UTF8, Encoding.GetEncoding("gb2312"), data, 0, data.Length);
return data;
}
{
byte[] data=ConvertUTF8ToGB2312 (Password );
MD5 md5 = MD5.Create();
data=md5.ComputeHash(data);
string ret = string.Empty;
data.ToList().ForEach(it => ret += it.ToString("x"));
return ret.Substring(8, 16);
}
public byte[] ConvertUTF8ToGB2312(string pwd)
{
byte[] data = Encoding.UTF8.GetBytes(pwd);
data = Encoding.Convert(Encoding.UTF8, Encoding.GetEncoding("gb2312"), data, 0, data.Length);
return data;
}