雷火电竞-中国电竞赛事及体育赛事平台

歡迎來到入門教程網(wǎng)!

vb

當(dāng)前位置:主頁 > 軟件編程 > vb >

vb 中的MD5加密在asp.net中的實現(xiàn)

來源:本站原創(chuàng)|時間:2020-01-10|欄目:vb|點擊:

1、web項目中方法

復(fù)制代碼 代碼如下:

System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("aaaa","MD5")
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("aaaa","MD5")

查看文檔方法:
復(fù)制代碼 代碼如下:

PublicSharedFunctionHashPasswordForStoringInConfigFile(ByValpasswordAsString,ByValpasswordFormatAsString)AsString
成員屬于:System.Web.Security.FormsAuthentication
摘要:
給定標(biāo)識哈希類型的密碼和字符串,該例程產(chǎn)生一個適合存儲在配置文件中的哈希密碼。
參數(shù):
password:要進(jìn)行哈希運算的密碼。
passwordFormat:要使用的哈希算法。選項有“sha1”或“md5”。
返回值:
返回一個包含哈希密碼的String。
PublicSharedFunctionHashPasswordForStoringInConfigFile(ByValpasswordAsString,ByValpasswordFormatAsString)AsString
成員屬于:System.Web.Security.FormsAuthentication
摘要:
給定標(biāo)識哈希類型的密碼和字符串,該例程產(chǎn)生一個適合存儲在配置文件中的哈希密碼。
參數(shù):
password:要進(jìn)行哈希運算的密碼。
passwordFormat:要使用的哈希算法。選項有“sha1”或“md5”。
返回值:
返回一個包含哈希密碼的String。

2、vb的應(yīng)用程序
復(fù)制代碼 代碼如下:

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

上一篇:使用vbs腳本添加程序到自啟動項的代碼

欄    目:vb

下一篇:VBS實現(xiàn)的系統(tǒng)服務(wù)備份優(yōu)化代碼

本文標(biāo)題:vb 中的MD5加密在asp.net中的實現(xiàn)

本文地址:http://www.jygsgssxh.com/a1/vb/7340.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有