vb 中的MD5加密在asp.net中的實現(xiàn)
更新時間:2013年04月11日 15:13:16 作者:
給定標識哈希類型的密碼和字符串,該例程產生一個適合存儲在配置文件中的哈希密碼,感興趣的朋友可以參考下本文
1、web項目中方法:
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("aaaa","MD5")
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("aaaa","MD5")
查看文檔方法:
PublicSharedFunctionHashPasswordForStoringInConfigFile(ByValpasswordAsString,ByValpasswordFormatAsString)AsString
成員屬于:System.Web.Security.FormsAuthentication
摘要:
給定標識哈希類型的密碼和字符串,該例程產生一個適合存儲在配置文件中的哈希密碼。
參數(shù):
password:要進行哈希運算的密碼。
passwordFormat:要使用的哈希算法。選項有“sha1”或“md5”。
返回值:
返回一個包含哈希密碼的String。
PublicSharedFunctionHashPasswordForStoringInConfigFile(ByValpasswordAsString,ByValpasswordFormatAsString)AsString
成員屬于:System.Web.Security.FormsAuthentication
摘要:
給定標識哈希類型的密碼和字符串,該例程產生一個適合存儲在配置文件中的哈希密碼。
參數(shù):
password:要進行哈希運算的密碼。
passwordFormat:要使用的哈希算法。選項有“sha1”或“md5”。
返回值:
返回一個包含哈希密碼的String。
2、vb的應用程序:
PublicSharedFunctionmd5str(ByRefstrSourceAsString)
DimdataToHashAsByte()=(NewSystem.Text.UnicodeEncoding).GetBytes(strSource.ToCharArray)
DimhashvalueAsByte()=CType(Cryptography.CryptoConfig.CreateFromName("MD5"),Cryptography.HashAlgorithm).ComputeHash(dataToHash)
DimstrSBAsNewSystem.Text.StringBuilder
ForiAsInt16=0Tohashvalue.Length-1
strSB.Append(hashvalue(i).ToString("x2"))
Next
DimcreatMD5=strSB.ToString
ReturncreatMD5
EndFunction
PublicSharedFunctionmd5str(ByRefstrSourceAsString)
DimdataToHashAsByte()=(NewSystem.Text.UnicodeEncoding).GetBytes(strSource.ToCharArray)
DimhashvalueAsByte()=CType(Cryptography.CryptoConfig.CreateFromName("MD5"),Cryptography.HashAlgorithm).ComputeHash(dataToHash)
DimstrSBAsNewSystem.Text.StringBuilder
ForiAsInt16=0Tohashvalue.Length-1
strSB.Append(hashvalue(i).ToString("x2"))
Next
DimcreatMD5=strSB.ToString
ReturncreatMD5
EndFunction
復制代碼 代碼如下:
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("aaaa","MD5")
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("aaaa","MD5")
查看文檔方法:
復制代碼 代碼如下:
PublicSharedFunctionHashPasswordForStoringInConfigFile(ByValpasswordAsString,ByValpasswordFormatAsString)AsString
成員屬于:System.Web.Security.FormsAuthentication
摘要:
給定標識哈希類型的密碼和字符串,該例程產生一個適合存儲在配置文件中的哈希密碼。
參數(shù):
password:要進行哈希運算的密碼。
passwordFormat:要使用的哈希算法。選項有“sha1”或“md5”。
返回值:
返回一個包含哈希密碼的String。
PublicSharedFunctionHashPasswordForStoringInConfigFile(ByValpasswordAsString,ByValpasswordFormatAsString)AsString
成員屬于:System.Web.Security.FormsAuthentication
摘要:
給定標識哈希類型的密碼和字符串,該例程產生一個適合存儲在配置文件中的哈希密碼。
參數(shù):
password:要進行哈希運算的密碼。
passwordFormat:要使用的哈希算法。選項有“sha1”或“md5”。
返回值:
返回一個包含哈希密碼的String。
2、vb的應用程序:
復制代碼 代碼如下:
PublicSharedFunctionmd5str(ByRefstrSourceAsString)
DimdataToHashAsByte()=(NewSystem.Text.UnicodeEncoding).GetBytes(strSource.ToCharArray)
DimhashvalueAsByte()=CType(Cryptography.CryptoConfig.CreateFromName("MD5"),Cryptography.HashAlgorithm).ComputeHash(dataToHash)
DimstrSBAsNewSystem.Text.StringBuilder
ForiAsInt16=0Tohashvalue.Length-1
strSB.Append(hashvalue(i).ToString("x2"))
Next
DimcreatMD5=strSB.ToString
ReturncreatMD5
EndFunction
PublicSharedFunctionmd5str(ByRefstrSourceAsString)
DimdataToHashAsByte()=(NewSystem.Text.UnicodeEncoding).GetBytes(strSource.ToCharArray)
DimhashvalueAsByte()=CType(Cryptography.CryptoConfig.CreateFromName("MD5"),Cryptography.HashAlgorithm).ComputeHash(dataToHash)
DimstrSBAsNewSystem.Text.StringBuilder
ForiAsInt16=0Tohashvalue.Length-1
strSB.Append(hashvalue(i).ToString("x2"))
Next
DimcreatMD5=strSB.ToString
ReturncreatMD5
EndFunction
您可能感興趣的文章:
- ASP.NET中DES加密與解密MD5加密幫助類的實現(xiàn)代碼
- VB.NET實現(xiàn)的MD5加密算法示例【32位】
- .NET MD5加密解密代碼解析
- asp.net實現(xiàn)的MD5加密和DES加解密算法類完整示例
- asp.net實現(xiàn)md5加密
- asp.net中使用cookie與md5加密實現(xiàn)記住密碼功能的實現(xiàn)代碼
- ASP.NET中MD5與SHA1加密的幾種方法
- 徹底解決ASP.NET MD5加密中文結果和ASP不一致的問題
- asp.net下常用的加密算法MD5、SHA-1應用代碼
- asp.net中MD5 16位和32位加密函數(shù)
- ASP.net中md5加密碼的方法
- .net core使用MD5加密解密字符串
相關文章
.NET微服務架構CI/CD自動構建Jenkins+Gitee
這篇文章介紹了.NET使用微服務架構CI/CD自動構建Jenkins+Gitee的方法,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2022-01-01
GridView控件實現(xiàn)數(shù)據(jù)的顯示和刪除(第8節(jié))
這篇文章主要介紹了GridView控件實現(xiàn)數(shù)據(jù)的顯示和刪除,以新聞網站為例,實現(xiàn)對新聞數(shù)據(jù)的操作,了解各種數(shù)據(jù)源控件與數(shù)據(jù)綁定控件的類型和作用,需要的朋友可以參考下2015-08-08
調試ASP.NET2005/2008時,端口不正確的解決三套方案
這篇文章主要介紹了調試ASP.NET2005/2008時,端口不正確的解決三套方案,小編就特別喜歡收藏這類文章,方便以后工作學習中遇到這類問題進行解決。2015-09-09
ASP.NET URL偽靜態(tài)重寫實現(xiàn)方法
ASP.NET下為靜態(tài)的實現(xiàn)方法。2009-12-12

