[js] 초간단 암호화/복호화 소스..
by The JavaScript Source
<!-- TWO STEPS TO INSTALL ASCII ENCRYPTION:
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: David Salsinha (david.salsinha@popsi.pt) -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function Encrypt(theText) {
output = new String;
Temp = new Array();
Temp2 = new Array();
TextSize = theText.length;
for (i = 0; i < TextSize; i++) {
rnd = Math.round(Math.random() * 122) + 68;
Temp[i] = theText.charCodeAt(i) + rnd;
Temp2[i] = rnd;
}
for (i = 0; i < TextSize; i++) {
output += String.fromCharCode(Temp[i], Temp2[i]);
}
return output;
}
function unEncrypt(theText) {
output = new String;
Temp = new Array();
Temp2 = new Array();
TextSize = theText.length;
for (i = 0; i < TextSize; i++) {
Temp[i] = theText.charCodeAt(i);
Temp2[i] = theText.charCodeAt(i + 1);
}
for (i = 0; i < TextSize; i = i+2) {
output += String.fromCharCode(Temp[i] - Temp2[i]);
}
return output;
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<center>
<form name=encform onsubmit="return false;">
<textarea name=box1 rows=5 cols=50>The quick brown fox jumps over the lazy dog</textarea>
<p>
<input type=button value="Encrypt Box1 to Box2" onClick="this.form.box2.value=Encrypt(this.form.box1.value);">
<p>
<textarea name=box2 rows=5 cols=50></textarea>
<p>
<input type=button value="Decrypt Box2 to Box3" onClick="this.form.box3.value=unEncrypt(this.form.box2.value);">
<p>
<textarea name=box3 rows=5 cols=50></textarea>
</form>
</center>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.83 KB -->
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
685 | Develop | [c++][mfc] 파일 입출력 샘플 (한줄씩 읽어서 다른 파일에 쓰기) | hooni | 2013.04.23 | 15059 |
684 | Develop | [unix] 쉘 스크립트 예제 모음 | hooni | 2003.04.23 | 15011 |
683 | Develop | [ios] UIWebView에서 NSURLRequest에 Cookie 실어 보내기 | hooni | 2014.01.16 | 14908 |
682 | Develop | [unix] 날짜 관련 쉘 명령어 (특정일 또는 +-시간, 날짜 계산된 값) | hooni | 2013.04.23 | 14889 |
681 | Develop | [css] z-index에 설정할 수 있는 최대값? | hooni | 2013.12.20 | 14807 |
680 | Develop | [ios] Objective-C에서 SQLite 사용하기.. | hooni | 2013.04.23 | 14580 |
679 | Develop | [ios] iOS In App Purchase #1 (코드 구현 전 웹 설정 작업) | hooni | 2013.11.20 | 14554 |
678 | Develop | [c] 메시지큐(Message Queue) 설명.. (joinc) | hooni | 2013.04.23 | 14305 |
677 | Develop | [c] vc++ 에서 clrscr(), gotoxy() 함수 사용하기.. | hooni | 2013.04.23 | 14291 |
676 | Develop | [C] C언어의 조건 연산자(Conditional Operator) | hooni | 2003.04.23 | 14284 |
675 | Develop | [c] 64bit 머신에서 inet_ntoa() 사용시 Segment fault 대처 방법법 | hooni | 2014.02.08 | 14262 |
674 | Develop | [c] 민수형 libipq 샘플 소스 ㅋㅋ | hooni | 2003.04.23 | 14145 |