JavaScript Source Code 3000: Password Protection: Character Encoder
Character Encoder
Encrypts a string by converting each character to it's ASCII key code. Supports two-way encryption - from a string to the numeric code, or from the numeric code back to the string. You can, for example, send the encrypted code to a friend and have them decode it with this script. Lots more uses, use your imagination!
Original String
Encrypted Code
JavaScript Source Code 3000: Password Protection: Character Encoder
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!
<!-- TWO STEPS TO INSTALL CHARACTER ENCODER:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Mike McGrath (mike_mcgrath@lineone.net) -->
<!-- Web Site: http://website.lineone.net/~mike_mcgrath/ -->
<! >
<! >
<!-- Begin
var str_in;
var str_out = "";
var num_in;
var num_out = "";
var e = "Enter Text!";
function str_to_num(form) {
num_out = "";
if(form.input.value == "") alert(e);
else {
str_in = escape(form.input.value);
for(i = 0; i < str_in.length; i++) {
num_out += str_in.charCodeAt(i) - 23;
}
form.output.value = num_out;
form.input.value = "";
}
}
function num_to_str(form) {
str_out = "";
if(form.output.value == "") alert(e)
else {
num_out = form.output.value;
for(i = 0; i < num_out.length; i += 2) {
num_in = parseInt(num_out.substr(i,[2])) + 23;
num_in = unescape('%' + num_in.toString(16));
str_out += num_in;
}
form.input.value = unescape(str_out);
form.output.value = "";
}
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<center>
<form name=encryptform>
<table>
<tr>
<td align=center>Original String</td>
<td> </td>
<td align=center>Encrypted Code</td>
</tr>
<tr>
<td align=center><input name=input type=text size=40 value="JavaScript Source"></td>
<td align=center>
<input type=button value="<--" onClick="javascript:num_to_str(this.form)"><br>
<input type=button value="-->" onClick="javascript:str_to_num(this.form)">
</td>
<td align=center><input name=output type=text size=40></td>
</tr>
</table>
</form>
</center>
<!-- Script Size: 1.86 KB -->
Wyszukiwarka
Podobne podstrony:
encode special charactersfunction utf8 encodeAttributeSet CharacterAttributeMetal Hollow Sphere Structures characteristicsfunction base64 encode2006 05?rtoon Creating Animated Characters with BlenderVtM Character Sheet Ravnosfunction imap utf7 encodereplace charactersTenchi Muyo Character SheetRealTime Character SheetTriStat dX Character SheetEncodedKeySpecencodedwięcej podobnych podstron