2009年4月21日 星期二

字串加密

System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(s,"md5");

System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(s,"sha1");

byte[] bt = System.Text.Encoding.Default.GetBytes(x);
System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] result = md5.ComputeHash(bt);
this.Label2.Text = System.Text.Encoding.Default.GetString(result);

byte[] bt = System.Text.Encoding.Default.GetBytes(x);
System.Security.Cryptography.SHA1 sha = new System.Security.Cryptography.SHA1CryptoServiceProvider();
byte[] result = sha.ComputeHash(bt);
this.Label2.Text = System.Text.Encoding.Default.GetString(result);

沒有留言:

張貼留言