Sub initCode(ByRef Infos) '自動生成密碼表 Count=-97 CodeArray=Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F") for z=0 to Ubound(CodeArray) for y=0 to Ubound(CodeArray) Infos.Add Cstr(Count),CodeArray(z) CodeArray(y) Count=Count+1 next next End Sub
Function GetImailPassword(User,Pass) 'Imail密碼加密函數(shù) encryptCode="" Set objDict=CreateObject("Scripting.Dictionary") Call initCode(objDict) User=Lcase(User) '將用戶轉(zhuǎn)為小寫 FirstChar=left(User,1) FirstCharCode=asc(FirstChar) '得到首字母的ASCII碼 Reference=FirstCharCode-97 '得到參考值 execute "Dim UserCode(" len(User)-1 ")" '定義兩個存放用戶與密碼ASCII的數(shù)組 execute "Dim PassCode(" len(Pass)-1 ")" for i=0 to len(User)-1 '取得用戶字母的偏移量 UChar=Asc(mid(User,i+1,1)) UserCode(i)=FirstCharCode-UChar next for j=0 to len(Pass)-1 '取得密碼對應的新值 PChar=Asc(mid(Pass,j+1,1)) iPos=j mod len(User) PassCode(j)=PChar+Reference-UserCode(iPos) next for k=0 to Ubound(PassCode) '查詢密碼表,最后得到密碼 encryptCode= encryptCode objDict.item(Cstr(PassCode(k))) next GetImailPassword=encryptCode end function