geel

要有耐心

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
一个php的应用,接受md5的密码用作验证,客户端是.net,发送请求。开始发现英文的没错误,中文的就对不上了。原来是编码问题,也只好又改了一下
public class Encryption
{
    
public static string md5(string str, string encodingStr)
    
{
        
try
        
{
            
byte[] hashvalue = (new MD5CryptoServiceProvider()).ComputeHash(Encoding.GetEncoding(encodingStr).GetBytes(str));
            
return BitConverter.ToString(hashvalue).Replace("-","").ToLower();
        }

        
catch
        
{
            
return String.Empty;
        }

    }

}
posted on 2004-10-24 23:25  geel  阅读(2739)  评论(3编辑  收藏  举报