Enter Your text into the text area.
No carriage returns or new lines are allowed. This a problem at the moment as each line feed is made of two characters and the encryption method moves one character at a time. Everytime half of the line feed is moved, it is converted into a two character line feed. Any suggestions most welcome.
Enter A password.
The password can contain any character but only a-z, A-Z and 0-9 are actually used. The password is converted into a hash code and this value is used to encrypt the text.
Click the 'Encrypt' button.
The encryption will begin and may take some time on slower or congested computers. Netscape users will see a percentage counter increment while Internet Explorer 4 users will see nothing. Why? Do not know...
The encryption may loop 2, 4 or 6 times. There is a counter to indicate which iteration the encryption is working on. Most commonly 6 iterations are required for the text to be fully coded. After each encryption the text will change in the text area. Please wait till the processing has stopped.
Copy the encrypted data into your HTML page.
If the encrypted data is sufficiently illegible, store the encrypted data in the <textarea> field of the HTML page you wish to have the text displayed and add the javascript routine required to decode. If you are not happy with the look of the encrypted data then try a different password. There is no way to predict how many iterations any password will take or what the final text will look like.
<form> HTML for your page:
<form>
Password: <input type="password" size=12 name="pass"><input type="button" value="Decode" onclick="de(this.form);"><br>
<textarea wrap="soft" name="ta" cols=60 rows=12>encrypted data here</textarea>
</form>
** Update 01/01/99 ** Carriage returns or line feeds are now allowed but you may still want to make sure that the encrypted data begins following the <textarea> tag and the </textarea> tag follows the last character of the encrypted data.
<script> for your page:
<script language="javascript">
function de(frm)
 { var a="abcdefghijklmnopqrstuvwxyz";
   var alpha=a+a.toUpperCase()+"0123456789";
   var buffer=new Array();
   for (i=0;i<20;i++) buffer[i]=new Array(-1,"");
   var hash=new Array();
   for (i=7;i<10;i+=2)
    { hash[i]=0;
      for (j=0;j<frm.pass.value.length;j++)
       { chr=frm.pass.value.substring(j,j+1);
         hash[i]=hash[i]*i+alpha.indexOf(chr,0); };
    };
   hash[9]+="";
   var ft=frm.ta; coded="";
   ft.value+="                    ";
   var cnt=0;
   for (i=0;i<ft.value.length;i++)
    { p=hash[9].charAt(cnt)*1+1; flag="x";
      for (j=0;j<buffer.length && isNaN(flag);j++)
       if (buffer[j][0]==i || buffer[j][0]==(p+i))
        flag=(buffer[j][0]!=(p+i))?j+1:-j;
      if (isNaN(flag))
       { chr=ft.value.charAt(p+i);
         for (k=0;k<buffer.length && buffer[k][0]>-1;k++)
          a=0;
         buffer[k][1]=ft.value.charAt(i);
         buffer[k][0]=(i+p);
         coded+=chr; }
      else
       { if(flag<1)
          { coded+=buffer[-flag][1]; 
            buffer[-flag][1]=ft.value.charAt(i)
            buffer[-flag][0]=(i+p); }
         else
          { coded+=buffer[flag-1][1];
            buffer[flag-1][0]=-1; };
       };
      cnt=(cnt+1)%hash[9].length;
      buffer.sort(fcmp); };

   frm.ta.value=unescape(coded);
 };
function fcmp(a,b)
 { return a[0]-b[0]; };
</script>