using System.Security.Cryptography;
string str =
"20070111";
![InBlock.gif](https://s1.51cto.com/images/editer/InBlock.gif)
SHA1 sha1 =
new SHA1CryptoServiceProvider();
byte[] bytes_sha1_in = UTF8Encoding.Default.GetBytes(str);
byte[] bytes_sha1_out = sha1.ComputeHash(bytes_sha1_in);
string str_sha1_out = BitConverter.ToString(bytes_sha1_out);
![InBlock.gif](https://s1.51cto.com/images/editer/InBlock.gif)
MessageBox.Show(str_sha1_out);
转载于:https://blog.51cto.com/yardan/60705