 <Script LANGUAGE="JavaScript">   // XOR Block Encryption 4 // Script Copyright 1999 Azrael, All Rights Reserved7 // In other words, don't take this and say it is yours! D // Also, don't even take this.  You must ask for permission from me.? // You can contact me at azrael@wwdg.com to request permission. W // Start setting some of the variables used in the script, including the character list    var thekey = ""  var keytobinary = "" var keytointeger = ""  var keybinary = "" var encryptedkey = ""  var encryptedmessage = "" m var thelist = "!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ "    function xorencrypt() { ' 	thekey = document.xorform.thekey.value - 	themessage = document.xorform.textarea.value ' 	//document.xorform.textarea.value = "" D 	var encryptedkey = "" //put this in the function to avoid recursionH 	var encryptedmessage = "" //put this in the function to avoid recursionl 	for (i = 0; i < thekey.length; i++) { // The loop for converting all parts of the key into ANSI then Binary 		var keytointeger = ""  		var keytobinary = ""3 		keytointeger = thelist.indexOf(thekey.charAt(i))  ! 		// Start finding the ANSI value e 		// Long procedure because need to remove characets not allowed like quotation marks and backslashes S 		if((keytointeger > 0) && (keytointeger < 58)) { keytobinary = keytointeger + 34 } T 		if((keytointeger > 57) && (keytointeger < 60)) { keytobinary = keytointeger + 35 }T 		if((keytointeger > 59) && (keytointeger < 92)) { keytobinary = keytointeger + 35 }g 		if(keytointeger == 92) { keytobinary = 255 } //If the character is a space, set the ANSI value as 255 o 		if(keytointeger == 0) { keytobinary = 33 } //If the character is an exclamation pt., set the ANSI value as 33  		if(keytointeger == -1) { keytobinary = 254 } //All other invalid characters have an ANSI value of 254, to be interpreted by the decrypter as go to the next line  + 		// Set up variables for binary conversion  		var quotient = keytobinary 		var binary = ""  		var thebinaryvalue = ""   $ 		// The binary conversion procedure# 		for (j = 0; quotient != 0; j++) { - 			var quotientwithremainder = (quotient / 2) 1 			quotient = (Math.floor(quotientwithremainder)) ; 			var remainder = ((quotientwithremainder - quotient) * 2)  			var binaryArray = new Array(remainder, thebinaryvalue) //Put the remainder into the Array to end up being part of the binary value = 			var thebinaryvalue = binaryArray.join("") //Join the Array  		 		}  		if((keytobinary < 128) && (keytobinary > 63)) { //If the ANSI value is less than 100, put a zero in the beginning of the binary value because the procedure can't factor this in by itself 			var binaryArrayWithZero = new Array("0", thebinaryvalue) //Section is used for debugging by adding a space in the procedure, but can stay in , 			var binary = binaryArrayWithZero.join("") 		}  		if((keytobinary < 64) && (keytobinary >= 0)) { //If the ANSI value is less than 100, put two zeros in the beginning of the binary value because the procedure can't factor this in by itself 			var binaryArrayWithZero = new Array("0", "0", thebinaryvalue) //Section is used for debugging by adding a space in the procedure, but can stay in, 			var binary = binaryArrayWithZero.join("") 		}  		if(keytobinary >= 128) { //If the ANSI value is greater than or equal to 100, don't put in a zero because the procedure can factor it as a 1 			var binaryArrayWithOutZero = new Array(thebinaryvalue) //Section is used for debugging by adding a space in the procedure, but can stay in / 			var binary = binaryArrayWithOutZero.join("")  		}  		& 		encryptedkey = encryptedkey + binaryN 		//document.xorform.textarea.value = document.xorform.textarea.value + binary 	} 	   t 	for (i = 0; i < themessage.length; i++) { // The loop for converting all parts of the message into ANSI then Binary 		var messagetointeger = ""  		var messagetobinary = ""; 		messagetointeger = thelist.indexOf(themessage.charAt(i))   		! 		// Start finding the ANSI value e 		// Long procedure because need to remove characets not allowed like quotation marks and backslashes c 		if((messagetointeger > 0) && (messagetointeger < 58)) { messagetobinary = messagetointeger + 34 } d 		if((messagetointeger > 57) && (messagetointeger < 60)) { messagetobinary = messagetointeger + 35 }d 		if((messagetointeger > 59) && (messagetointeger < 92)) { messagetobinary = messagetointeger + 35 }o 		if(messagetointeger == 92) { messagetobinary = 255 } //If the character is a space, set the ANSI value as 255  		if(messagetointeger == 0) { messagetobinary = messagetointeger + 33 } //If the character is an exclamation pt., set the ANSI value as 33 		if(messagetointeger == (-1)) { messagetobinary = 254 } //All other invalid characters have an ANSI value of 254, to be interpreted by the decrypter as go to the next line 		+ 		// Set up variables for binary conversion ! 		var quotient2 = messagetobinary  		var binary2 = "" 		var thebinaryvalue2 = ""  $ 		// The binary conversion procedure$ 		for (j = 0; quotient2 != 0; j++) {/ 			var quotientwithremainder2 = (quotient2 / 2) 3 			quotient2 = (Math.floor(quotientwithremainder2)) > 			var remainder2 = ((quotientwithremainder2 - quotient2) * 2) 			var binaryArray2 = new Array(remainder2, thebinaryvalue2) //Put the remainder into the Array to end up being part of the binary value? 			var thebinaryvalue2 = binaryArray2.join("") //Join the Array  		}  		if((messagetobinary < 128) && (messagetobinary > 63)) { //If the ANSI value is less than 100, put a zero in the beginning of the binary value because the procedure can't factor this in by itself 			var binaryArrayWithZero2 = new Array("0", thebinaryvalue2) //Section is used for debugging by adding a space in the procedure, but can stay in . 			var binary2 = binaryArrayWithZero2.join("") 		}  		if((messagetobinary < 64) && (messagetobinary >= 0)) { //If the ANSI value is less than 100, put two zeros in the beginning of the binary value because the procedure can't factor this in by itself 			var binaryArrayWithZero2 = new Array("0", "0", thebinaryvalue2) //Section is used for debugging by adding a space in the procedure, but can stay in. 			var binary2 = binaryArrayWithZero2.join("") 		}  		if(messagetobinary >= 128) { //If the ANSI value is greater than or equal to 100, don't put in a zero because the procedure can factor it as a 1 			var binaryArrayWithOutZero2 = new Array(thebinaryvalue2) //Section is used for debugging by adding a space in the procedure, but can stay in 1 			var binary2 = binaryArrayWithOutZero2.join("")  		}  		/ 		encryptedmessage = encryptedmessage + binary2 - 		//document.xorform.textarea.value = binary2 O 		//document.xorform.textarea.value = document.xorform.textarea.value + binary2  	}    ( 	var keyloop = (encryptedkey.length / 8) 	var substringkey1 = 0 	var substringkey2 = 8 	var substringmessage1 = 0 	var substringmessage2 = 8	  	var encryptedbitvalue = ""  	var theencryptedbitvalue = "" 	var finalxormessage = ""  	  	for (k = 0; k < (encryptedmessage.length / 8); k++) { // XOR the key binary values and the message binary values AKA encrypt the message " 		//alert(encryptedmessage.length) 		var xorkey = encryptedkey.substring(substringkey1,substringkey2) //Take the binary value for the character which is 8 bits of key  		var xormessage = encryptedmessage.substring(substringmessage1,substringmessage2) //Take the binary value for the first character which is 8 bits of key \ 		for (m = 0; (m + 1) <= 8; m++) { //FOR loop to compare the key and message 1 bit at a time0 			var onebitofkey = xorkey.substring(m,(m + 1))8 			var onebitofmessage = xormessage.substring(m,(m + 1))A 			if(onebitofkey == onebitofmessage) { encryptedbitvalue = "0" } A 			if(onebitofkey != onebitofmessage) { encryptedbitvalue = "1" } O 			var encryptedblockArray = new Array(theencryptedbitvalue, encryptedbitvalue) : 			var theencryptedbitvalue = encryptedblockArray.join("") 		}  		substringkey1 += 8@ 		if(substringkey1 >= encryptedkey.length) { substringkey1 = 0 }A 		//if(substringkey1 < (substringkey1 + 1)) { substringkey1 = 0 } % 		substringkey2 = (substringkey1 + 8)  		substringmessage1 += 8- 		substringmessage2 = (substringmessage1 + 8) X 		var runningxorencryptedmessageArray = new Array(finalxormessage, theencryptedbitvalue)@ 		var finalxormessage = runningxorencryptedmessageArray.join("") 		theencryptedbitvalue = "" //reset this variable so it doesn't perform a running total kinda thing, and if it does it really messes things up 	}a 	document.xorform.textarea.value = finalxormessage //Put the encrypted value into the message box  	  }    function xordecrypt() { ' 	thekey = document.xorform.thekey.value - 	themessage = document.xorform.textarea.value ' 	//document.xorform.textarea.value = "" D 	var encryptedkey = "" //put this in the function to avoid recursionH 	var encryptedmessage = "" //put this in the function to avoid recursionl 	for (i = 0; i < thekey.length; i++) { // The loop for converting all parts of the key into ANSI then Binary 		var keytointeger = ""  		var keytobinary = ""3 		keytointeger = thelist.indexOf(thekey.charAt(i))    ! 		// Start finding the ANSI value e 		// Long procedure because need to remove characets not allowed like quotation marks and backslashes S 		if((keytointeger > 0) && (keytointeger < 58)) { keytobinary = keytointeger + 34 } T 		if((keytointeger > 57) && (keytointeger < 60)) { keytobinary = keytointeger + 35 }T 		if((keytointeger > 59) && (keytointeger < 92)) { keytobinary = keytointeger + 35 }g 		if(keytointeger == 92) { keytobinary = 255 } //If the character is a space, set the ANSI value as 255 o 		if(keytointeger == 0) { keytobinary = 33 } //If the character is an exclamation pt., set the ANSI value as 33  		if(keytointeger == -1) { keytobinary = 254 } //All other invalid characters have an ANSI value of 254, to be interpreted by the decrypter as go to the next line  + 		// Set up variables for binary conversion  		var quotient = keytobinary 		var binary = ""  		var thebinaryvalue = ""   $ 		// The binary conversion procedure# 		for (j = 0; quotient != 0; j++) { - 			var quotientwithremainder = (quotient / 2) 1 			quotient = (Math.floor(quotientwithremainder)) ; 			var remainder = ((quotientwithremainder - quotient) * 2)  			var binaryArray = new Array(remainder, thebinaryvalue) //Put the remainder into the Array to end up being part of the binary value = 			var thebinaryvalue = binaryArray.join("") //Join the Array  			  		}  		if((keytobinary < 128) && (keytobinary > 63)) { //If the ANSI value is less than 100, put a zero in the beginning of the binary value because the procedure can't factor this in by itself 			var binaryArrayWithZero = new Array("0", thebinaryvalue) //Section is used for debugging by adding a space in the procedure, but can stay in , 			var binary = binaryArrayWithZero.join("") 		}  		if((keytobinary < 64) && (keytobinary >= 0)) { //If the ANSI value is less than 100, put two zeros in the beginning of the binary value because the procedure can't factor this in by itself 			var binaryArrayWithZero = new Array("0", "0", thebinaryvalue) //Section is used for debugging by adding a space in the procedure, but can stay in, 			var binary = binaryArrayWithZero.join("") 		}  		if(keytobinary >= 128) { //If the ANSI value is greater than or equal to 100, don't put in a zero because the procedure can factor it as a 1 			var binaryArrayWithOutZero = new Array(thebinaryvalue) //Section is used for debugging by adding a space in the procedure, but can stay in / 			var binary = binaryArrayWithOutZero.join("")  		}  		& 		encryptedkey = encryptedkey + binaryN 		//document.xorform.textarea.value = document.xorform.textarea.value + binary 	}  7 	var encryptedmessage = document.xorform.textarea.value ( 	var keyloop = (encryptedkey.length / 8) 	var substringkey1 = 0 	var substringkey2 = 8 	var substringmessage1 = 0 	var substringmessage2 = 8	  	var encryptedbitvalue = ""  	var theencryptedbitvalue = "" 	var finalxormessage = ""  	var thelistlocation = ""  	  	for (k = 0; k < (encryptedmessage.length / 8); k++) { // XOR the key binary values and the message binary values AKA encrypt the message " 		//alert(encryptedmessage.length) 		var xorkey = encryptedkey.substring(substringkey1,substringkey2) //Take the binary value for the character which is 8 bits of key  		var xormessage = encryptedmessage.substring(substringmessage1,substringmessage2) //Take the binary value for the first character which is 8 bits of key \ 		for (m = 0; (m + 1) <= 8; m++) { //FOR loop to compare the key and message 1 bit at a time0 			var onebitofkey = xorkey.substring(m,(m + 1))8 			var onebitofmessage = xormessage.substring(m,(m + 1))A 			if(onebitofkey == onebitofmessage) { encryptedbitvalue = "0" } A 			if(onebitofkey != onebitofmessage) { encryptedbitvalue = "1" } O 			var encryptedblockArray = new Array(theencryptedbitvalue, encryptedbitvalue) : 			var theencryptedbitvalue = encryptedblockArray.join("") 		}  		substringkey1 += 8@ 		if(substringkey1 >= encryptedkey.length) { substringkey1 = 0 }A 		//if(substringkey1 < (substringkey1 + 1)) { substringkey1 = 0 } % 		substringkey2 = (substringkey1 + 8)  		substringmessage1 += 8- 		substringmessage2 = (substringmessage1 + 8) X 		var runningxorencryptedmessageArray = new Array(finalxormessage, theencryptedbitvalue)@ 		var finalxormessage = runningxorencryptedmessageArray.join("") 		theencryptedbitvalue = "" //reset this variable so it doesn't perform a running total kinda thing, and if it does it really messes things up 	}c 	//document.xorform.textarea.value = finalxormessage //Put the encrypted value into the message box    	var substringansi1 = 0  	var substringansi2 = 8  	var finalansimessage = "" 	var finalmessage = "" 	 5 	for (l = 0; l < (finalxormessage.length / 8); l++) {  	var ansimessage = 0M 	var toansimessage = finalxormessage.substring(substringansi1,substringansi2) ? 	if((toansimessage.substring(0,1)) == 1) { ansimessage += 128 } > 	if((toansimessage.substring(1,2)) == 1) { ansimessage += 64 }> 	if((toansimessage.substring(2,3)) == 1) { ansimessage += 32 }> 	if((toansimessage.substring(3,4)) == 1) { ansimessage += 16 }= 	if((toansimessage.substring(4,5)) == 1) { ansimessage += 8 } = 	if((toansimessage.substring(5,6)) == 1) { ansimessage += 4 } = 	if((toansimessage.substring(6,7)) == 1) { ansimessage += 2 } = 	if((toansimessage.substring(7,8)) == 1) { ansimessage += 1 }  	  	substringansi1 += 8& 	substringansi2 = (substringansi1 + 8)  T 	if((ansimessage > 33) && (ansimessage < 91)) { thelistlocation = ansimessage - 33 }b 	if((ansimessage > (57 + 33)) && (ansimessage < (60 + 35))) { thelistlocation = ansimessage - 33 }b 	if((ansimessage > (59 + 33)) && (ansimessage < (92 + 35))) { thelistlocation = ansimessage - 34 }2 	if(ansimessage == (255)) { thelistlocation = 93 }. 	if(ansimessage == 33) { thelistlocation = 1 }1 	if(ansimessage == 254) { thelistlocation = 221 }   + 	//var thelistlocation = (ansimessage - 34) M 	var theletter = (thelist.substring((thelistlocation),(thelistlocation - 1))) 0 	if(thelistlocation == 221) { theletter = "\n" } 	  	//alert(theletter) 8 	var theletterArray = new Array(finalmessage, theletter)+ 	var finalmessage = theletterArray.join("")   I 	//var runningAnsiMessageArray = new Array(finalansimessage, ansimessage) ; 	//var finalansimessage = runningAnsiMessageArray.join(" ")  	ansimessage = ""  	thelistlocation = ""  	}/ 	document.xorform.textarea.value = finalmessage  }     	 </SCRIPT>  <FORM NAME="xorform">  The KEY:<br>4 <INPUT TYPE="TEXT" NAME="thekey" VALUE="" SIZE="30"> <p>  The Message:<br>Q <TEXTAREA NAME="textarea" ROWS="10" COLS="70" VALUE="" WRAP="VIRTUAL"></TEXTAREA>  <br>? <INPUT TYPE="button" onClick="xorencrypt()" VALUE="Encrypt It"> ? <INPUT TYPE="button" onClick="xordecrypt()" VALUE="Decrypt It"> $ <INPUT TYPE="reset" VALUE=" Reset "> </FORM> 