关于一个算法。这个算法是SICAU教务系统在账号登录时采取的一个加密算法。算法的实现并不复杂。
具体如下:
Function Form1pwdvalue(ByVal pwdvalue As String, ByVal Temp As Double) As String
Dim dcode
Dim dcode1
Dim dcode2 As String
Dim tmpstr
Dim dcodelen
Dim i
dcode = pwdvalue
dcode1 = ""
dcode2 = Temp
dcode2 = "" & dcode2 *
dcodelen = Len(dcode)
For i = To dcodelen
tmpstr = Mid(dcode, i, )
dcode1 = dcode1 + ChrW(AscW(Mid(tmpstr, , )) - i - Mid(dcode2, i, ))
Next
Form1pwdvalue = dcode1
End Function
有趣的是即使密码“输错了”,这个算法加密的结果仍然相同。这里的输错是指大写写。无论密码中那个字符的大小错误均能通过。
例如:
abcdef=ABcDeF
关键在于: ChrW(AscW(Mid(tmpstr, , )) - i - Mid(dcode2, i, ))
这条语句。