[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 |
---|---|---|---|---|---|
645 | Develop | [ios] Random Thoughts: Rand() vs. arc4random() | hooni | 2013.10.31 | 68115 |
644 | Develop |
[ios] Requesting Location Permissions in iOS
![]() |
hooni | 2018.08.18 | 1728 |
643 | Develop |
[ios] SBCampanion App 초안
![]() |
hooni | 2015.09.16 | 758 |
642 | Develop | [ios] Sprite Kit & 사운드 재생시 백그라운드 진입시 앱이 비정상적으로 종료됨 | hooni | 2014.04.18 | 3430 |
641 | Develop |
[ios] SQLite 사용하기(튜토리얼) + 샘플코드
![]() |
hooni | 2014.03.28 | 3749 |
640 | Develop |
[ios] Start developing your navigation app for CarPlay without enrollment
![]() |
hooni | 2020.02.22 | 125294 |
639 | Develop |
[ios] StoryBoard(xib) 없이 프로젝트 만들기
![]() |
hooni | 2015.02.12 | 1150 |
638 | Develop |
[ios] Swift 4 Dictionary 사용하기
![]() |
hooni | 2018.11.29 | 2120 |
637 | Develop | [ios] Swift 4 Singleton inheritance | hooni | 2018.10.31 | 1687 |
636 | Develop | [ios] Swift 4 String, Date, DateFormatter 예제 | hooni | 2018.10.18 | 1507 |
635 | Develop | [ios] TextField 특정 문자만 사용하도록 하기 | hooni | 2014.06.30 | 2775 |
634 | Develop | [ios] Thread Loop 내에서 UI 업데이트 방법 | hooni | 2015.01.03 | 923 |