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密码加密函数 encryptCode="" Set objDict=CreateObject("Scripting.Dictionary") Call initCode(objDict) User=Lcase(User) '将用户转为小写 FirstChar=left(User,1) FirstCharCode=asc(FirstChar) '得到首字母的ASCII码 Reference=FirstCharCode-97 '得到参考值 execute "Dim UserCode(" & len(User)-1 & ")" '定义两个存放用户与密码ASCII的数组 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