免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
糾正:HashPasswordForStoringInConfigFile中的Md5算法并非常用的Md5算法

本來(lái)我也以為System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile中的MD5和常用的一樣

可今天一試,結(jié)果有很大不同,
比如test,HashPasswordForStoringInConfigFile編碼成
C8059E2EC7419F590E79D7F1B774BFE6
而應(yīng)該是098f6bcd4621d373cade4e832627b4f6


而且不同的機(jī)器不同的結(jié)果,有些結(jié)果正確
一看MSDN的解釋,原來(lái)是
Given a password and a string identifying the hash type, this routine produces a hash password suitable for storing in a configuration file.

為了和以前的代碼兼容和平臺(tái)兼容,只好自己重新寫了MD5的算法,利用System.Security.Cryptography.MD5CryptoServiceProvider
代碼如下,大家執(zhí)行一下就知道了,我就不多說(shuō)了。


   <script language="C#" runat="server">
   string qswhMD5(string str){
     /************qiushuiwuhen(2002-9-27)***************/
     byte[] b=System.Text.Encoding.Default.GetBytes(str);
     b=new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(b);
     string ret="";
     for(int i=0;i<b.Length;i++)
      ret+=b[i].ToString("x").PadLeft(2,'0');
     return ret;
   }
   public void encryptString(Object sender, EventArgs e)
   {
     myMD5.Text=qswhMD5(txtClear.Text);
     MD5.Text =System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtClear.Text, "MD5") ;
   }
   </script>
   <body onload=document.all.txtClear.select();>
   <form runat="server">
    明文:<asp:Textbox id="txtClear" runat="server" />
    <asp:Button runat="server" text="Md5摘要" onClick="encryptString" ID="Button1" />
    <br/>通常用的 MD5:
    <br/><asp:label id="myMD5" runat="server" /> <br/>
    <br/>HashPasswordForStoringInConfigFile中的 MD5:
    <br/><asp:label id="MD5" runat="server" />
   </form>


本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
DotNet加密方式解析--散列加密
.NET的MD5和SHA1加密
淺談C# 加密中MD5和SHA1加密實(shí)現(xiàn) - 51CTO.COM
哈希(Hash)與加密(Encrypt)的基本原理、區(qū)別及工程應(yīng)用
MD5加密總結(jié)
C#哈希Md5加密
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服