The command-line Script Encoder utility (screnc.exe) is responsible for encodingscripts. To determine what to encode, the Script Encoder looks for a start encode marker, which takes the following form for VBScript code:
'**Start Encode**
The Script Encoder encodes the file from the point at which the start encode marker is encountered until the closing or %> tag, or until the end of the file is found. If there is no start encode marker, the Script Encoder encodes the entire script block indicated by the , <%...%>, or <%=...%> tags, or it will encode the entire file if no tags are encountered.
In addition to encoding the script, the Script Encoder changes the LANGUAGE attribute of the tag from VBScript to VBScript.Encode. For an ASP page, it also adds the following attribute to the beginning of the page:
<%@ LANGUAGE = VBScript.Encode %>
When the page is loaded and the script is executed, VBScript.Encode serves as the programmatic identifier that specifies not only the language in use, but also the COM component responsible for parsing and handling the script. The hosting environment, such as ASP or the MSIE browser, uses the programmatic identifier to look up the class identifier, which, in this case, corresponds to COM components in vbscript.dll. So vbscript.dll is responsible for not only interpreting and executing the codes, but also for decoding it.