我想知道这种方法是否可以安全地用于登录,因为这是我发现的唯一一种易于理解的方法,并且它是 asp-classic,因此我的菜鸟可以理解并添加到我拥有的网站。
谢谢
<%
Dim sDigest,sPassword,sSalt
sDigest=SHA256(sRndStr)
sPassword = Request.Form("pass")
sSalt = Request.Form("username") & "SomeThingThatisStatic1234567890"
With CreateObject("CAPICOM.HashedData")
.Algorithm = 6 '<--- This will use SHA-512
'CAPICOM_HASH_ALGORITHM_SHA1 = 0
'CAPICOM_HASH_ALGORITHM_MD2 = 1
'CAPICOM_HASH_ALGORITHM_MD4 = 2
'CAPICOM_HASH_ALGORITHM_MD5 = 3
'CAPICOM_HASH_ALGORITHM_SHA_256 = 4 - Not supported on Windows XP or 2000
'CAPICOM_HASH_ALGORITHM_SHA_384 = 5 - Not supported on Windows XP or 2000
'CAPICOM_HASH_ALGORITHM_SHA_512 = 6 - Not supported on Windows XP or 2000
.Hash sPassword & sSalt
'Response.Write "Here is your hash: " & .Value
'---> here i would then check this hash with the hash in the database
'---> and if it's the same let the user login if not go to error: wrong info.
End With
%>