SHA1加密C#

   //SHA1

        static public string SHA1_Hash(string str_sha1_in)
        {

            SHA1 sha1 = new SHA1CryptoServiceProvider();

            byte[] bytes_sha1_in = UTF8Encoding.Default.GetBytes(str_sha1_in);

            byte[] bytes_sha1_out = sha1.ComputeHash(bytes_sha1_in);

            string str_sha1_out = BitConverter.ToString(bytes_sha1_out);

            //str_sha1_out = str_sha1_out.Replace("-", "");

            return str_sha1_out;

        }

 

posted @ 2014-12-15 15:58  临冰听雪丶  阅读(217)  评论(0编辑  收藏  举报