asp.net对字符串进行SHA1加密

//以字节方式存储  

byte[] data = System.Text.Encoding.Default.GetBytes(Pwd);

System.Security.Cryptography.SHA1 sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();

//得到哈希值

byte[] result = sha1.ComputeHash(data);

//转换成为字符串的显示

return System.BitConverter.ToString(result).Replace("-", ""); 

posted @ 2017-02-11 09:31  Rexcnblog  阅读(1689)  评论(0编辑  收藏  举报