# IMail cipher encryption algorithm and VBS implementation

Time：2020-11-23

All iMail’s post office information, such as users and passwords, is actually stored in the computer registry, so you only need to
Open the registry to see all the information in iMail, including the user’s password
Details:
IMail stores all enterprise post office information in:
In such a key, domainname is the post office name, and the user name is the user name. Under < username >, there is a key named password, which is the stored user password. The password is not stored in plaintext, but generated after simple encryption operation. Its encryption process is as follows:
1. Read the user name and make it all lowercase
2. Convert each number of user name into corresponding ASCII code
3. Calculate the offset of each letter and the first letter in the user name
4. Calculate the corresponding ASCII code of each password letter
5. Add the reference value (the ASCII of the first letter of the user name minus 97) to each ASCII code of the password, and then add the offset corresponding to the user name
6. You can get the password by corresponding to the password table
The specific procedures are as follows:

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)
Count=Count+1
next
next
End Sub

encryptCode=””
Set objDict=CreateObject(“Scripting.Dictionary”)
Call initCode(objDict)
User = lcase (user) ‘converts the user to lowercase
FirstChar=left(User,1)
First charcode = ASC (firstchar) ‘get the ASCII code of the first letter
Reference = firstcharcode-97 ‘to get the reference value
Execute “dim usercode (” & len (user) – 1 & “)” ‘defines two arrays to store user and password ASCII
execute “Dim PassCode(” & len(Pass)-1 & “)”
For I = 0 to len (user) – 1 ‘gets the offset of the user’s letter
UChar=Asc(mid(User,i+1,1))
UserCode(i)=FirstCharCode-UChar
next
For J = 0 to len (pass) – 1 ‘to obtain the new value corresponding to the password
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