Developer Package


Encoder/Decoder software

The Encoder and Decoder applets pass a string to and from an HTML FORM field. Typically this is a textarea form field, text, or hidden form field. Once the string is passed it can be handled routinely with the form data, such as with a Perl call to the $ENV variable.

The only requirement is that the string remain intact. If someone encodes a password, for example, the Encoder applet scrambles the password into the longer encoded string. When the encoded string is to be decoded it must be the same with the exception the decoder will strip off leading and trailing white spaces as which are sometimes passed in a 'copy n paste' operation.




Encoder/Decoder Demo

(Try It.)



Download This Package

(Download includes this 'description page', the demoTest.html web page (click above) and the encoder and decoder class files - 14K in zip file. Or you can take a look at the source code for this web page and download class files directly.)



Encoder

The applet code added to a web page for the Encoder applet looks like this:

<applet code = "PXecd.class" name = "gammaClass" codebase = "classes/" width = "1" height = "1" mayscript>
</applet>

The attributes of this html applet tag are as follows.


code is the name of the Java class file called.


name is the name assigned to this specific web page document object (the applet) and is used by JavaScript when the object is called.


codebase is the URL where the Java class file is stored. In this example it has been placed in a directory labeled 'classes'. A full URL can be used just as easily, for example codebase = "http://www.orderformcity.com/classes/". The codebase can also be on a floppy or C drive, such as 'file://A/:xyz/misc/classes/' which is useful when calling the Decoder program and to keep it isolated for security purposes. That way the floppy (or CD) must be inserted to access the decoder.


width and height This drives some people bonkers but applets cannot be invisible and must be assigned space on the web page, the minimum being 1 x 1 pixel.


'mayscript' must be present in the applet code for the applet to pass information to and from JavaScript.




The web page containing the Encoder applet must have the following JavaScript code (preferrably in the header):


<script language = "JavaScript">

var xyz;

function encodeMessage()
{
xyz = window.document.gammaClass.fetchEncode();
window.document.WEB_FORM.MESSAGE.value = xyz;
}

</script>

The JavaScript function above is calling a method in the Java class called fetchEncode(). It also turns right around and writes the String returned from fetchEncode() to the html form element named MESSAGE.


This is not negotiable. The Java code calls the message to encode directly from the form element here called MESSAGE. The Java code is compiled with that variable in the code named MESSAGE. The name of the html form, here called WEB_FORM, is also compiled in the Java code and it too must be supplied when the Java code is compiled. Either that or the web page author can use the default names of WEB_FORM and MESSAGE.


For example, the html form code included with this example is:


<form name = "WEB_FORM">
<textarea name = "MESSAGE" rows = "4" cols = "30" wrap = "hard">

etc. etc.

Notice the form element is a textarea. It can be hidden field just as easily.




Once the data has been assigned to the form field it can be called or reassigned typically, such as with a Perl call to the $ENV variable.




Decoder

The Decoder applet is handled in the same way as the Encoder applet:


<applet code = "PXdcd.class" codebase = "classes/" name = "deltaClass" width = "1" height = "1" mayscript^#62
</applet>

All of the applet code attribute information for the Encoder applet, listed above, applies here, to the Decoder. The only difference is the class file name, 'PXdcd.class' and the document object name, 'deltaClass


The JavaScript code for the Decoder is almost identical as well:


function decodeMessage()
{

abc = window.document.deltaClass.fetchDecode();
window.document.WEB_FORM.MESSAGE.value = abc;
}




This Zip Package


Typically the Encoder and Decoder are on separate web pages. The Decoder page may even be generated with Perl script, for example, and the codebase to the applet class file is on a floppy.

Included with the zip package are these instructions, the Encoder applet, the Decoder applet, and a very simple demonstration web page. The main purpose of the demonstration web page, demoTest.html, is to provide the JavaScript code you can just copy and paste onto your desired page.

Note: This demo is not recommended for permanent use. This package is available free to anyone online and the Encryption/Decryption algorithm is the same to whomever has downloaded this package. It is highly recommended that you order a customized algorithm for your applied set of Encoder/Decoder software. Any code you develop with this demo software can be used with your customized version that will have your own unique algorithm.

You might also note the demo included with this package has a clear button. The button calls the 'clearMessage()' function in the JavaScript code for this button viewable in the demoTest.html page header code.





email