C#中将字符串转换为MD5

        private string getMd5(string password)
        
{
            
byte[] pasArray = System.Text.Encoding.Default.GetBytes(password);
            pasArray 
= new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(pasArray);
            
string rMd5Str = "";
            
foreach(byte ibyte in pasArray)
                rMd5Str 
+= ibyte.ToString("x").PadLeft(2'0');
            
return rMd5Str;
        }

posted on 2006-07-25 15:35  龙少爷  阅读(1190)  评论(0编辑  收藏  举报

导航