ȸ¿ø·Î±×ÀÎ
¹®ÀÚ¿ ÀÎÄÚµù - µðÄÚµù ÇÕ´Ï´Ù
18³â Àü
<script language="javascript">
<!--
// ¾ÏȣȽà »ç¿ëÇÏ´Â ¹®ÀÚ
var char_set = '$%^NOZ1&PQR(./~`"CDEFG!@STUVWZghij}:<pHB*#8uvwx>?[]\',ef34590qrklmnoIJ)_+{st67 abcdAyzKLM2Y';
function crypt_data(crypt_type) {
var space;
var char_code;
var output = "";
var input = window.input.input_field.value;
var algorithm = window.input.shift_select.selectedIndex;
var alpha_length = char_set.length - algorithm;
algorithm++;
for(loop=0; loop<input.length; loop++) {
if(char_set.indexOf(input.charAt(loop)) == -1) {
// ¿ø¹® : Program Error: Unknown Character!
alert("¿À·ù : Character¸¦ ¾Ë ¼ö ¾ø½À´Ï´Ù.");
}
char_code = char_set.indexOf(input.charAt(loop));
// ÀÎÄÚµù ¸í·É
if(crypt_type == "encrypt") {
if(char_code + algorithm > char_set.length) {
space = char_set.length - char_code;
char_code = algorithm - space;
} else {
char_code += algorithm;
}
} else
// µðÄÚµù ¸í·É
if(crypt_type == "decrypt") {
if(char_code - algorithm < 0) {
space = algorithm - char_code;
char_code = char_set.length - space;
} else {
char_code -= algorithm;
}
}
output += char_set.charAt(char_code);
}
window.input.input_field.value = output;
}
//-->
</script>
<center>
<form name="input">
<TEXTAREA name="input_field" cols="70" rows="15"></TEXTAREA><br>
<b>Key : </b>
<select name="shift_select">
<option>1
<option>2
<option>3
<option>4
<option selected>5
<option>6
<option>7
<option>8
<option>9
</select>
<input type="button" value="EnCrypt" onclick="crypt_data('encrypt');">
<input type="button" value="DeCrypt" onclick="crypt_data('decrypt');">
</form>
</center>
̵̧ : 395
̵̧
¸ñ·Ï