Script encoding for VBScript and JScript

The latest release of Microsoft's VBScript and JScript language engines provide support for script encoding. Script encoding helps protect the intellectual property you have in your scripts by making them illegible. We introduce you to this new feature and explain how you can use it to protect your scripts.
To encode your script, you need to download and install the Script Encoder tool from Microsoft's web-site. You can find the tool at Microsoft's Scripting Site. This tool encodes your script for use with the latest language engines from Microsoft. The encoded scripts only run with this language engine thereby limiting this feature mostly to Internet Explorer 5.0 users. All browsers without this language engine will ignore the script block.

The script encoder runs from the command prompt. By default all scripts on your page are encoded. Any HTML on the page is left untouched. To encode scripts on a page you simply run the script encoder as follows:

SCRENC input.htm output.htm

Below we encode a simple script that displays the current date and time on the page:

<SCRIPT>
document.write(new Date())
</SCRIPT>
After running the script through the encoder, the script is encoded and the language is modified to represent this encoding:
<SCRIPT language = JScript.Encode>
#@~^IgAAAA==@#@&NG1Es+xDRS.kD+cxh~9mY+vb#@#@&cAkAAA==^#~@
</SCRIPT>

By default, the entire script is encoding. However, even though your scripts are encoded, you will often want to include a copyright notice within the script block. By controlling where the script encoder should start encoding with the "**Start Encode**" comment you can ensure you leave important comments in the script's header.
For example, to preserve a copyright when encoding the script:

&ly;SCRIPT>
//Copyrightę 2001. security.ipfox.com, LLC All rights reserved.
//**Start Encode**
document.write(new Date())
</SCRIPT>
Now the copyright is left intact and the script following the copyright is encoded.
Encoded scripts only run on browsers that have the 5.0 or later release of Microsoft's scripting engines. The 5.0 engine comes with Internet Explorer 5.0 and can be optionally installed by the user with previous versions of Internet Explorer. For the most part, this feature is only usable with scripts targeting Internet Explorer 5.0. Where script encoding becomes very useful is when combined with another Internet Explorer 5 feature - behaviors.