This simple HTML
application made with notepad can encrypt and decrypt the text entered into a
text box using the given password. The encrypted output of the program is in
only uppercase alphabet letters and numbers. The drawback of the program is
that it wills double the length of the string when encrypting.
1. First copy bellow code
<html>
<head>
<title>TextEncrypt</title>
<HTA:APPLICATION
APPLICATIONNAME="TextEncrypt"
ID="TextEncrypt"
VERSION="1.0"
MAXIMIZEBUTTON="no"
SCROLL="no"/>
</head>
<style>
body {background-color: #000000;
color: #808080;}
input {background-color: #101010;
color: #808080;}
textarea {background-color: #202020;
color: #808080;}
</style>
<script language="VBScript">
Sub Window_OnLoad
Dim width,height
width=460
height=400
self.ResizeTo width,height
End Sub
Function Validate(ID)
On Error Resume Next
Key = Int(pswd.value)
If (pswd.value = "") Then
X = MsgBox("Enter a password!", 48, "ERROR!")
Else If (boxa.value = "") Then
X = MsgBox("Enter the text to encrypt or decrypt!", 48, "ERROR!")
Else
Junk = SetTimeOut(KEYS(ID), 1)
End If
End If
End Function
Function KEYS(ID)
text = pswd.value
code = 0
Do Until text = ""
code = ((Asc(Left(text, 1)))+code)
text = Replace(text, Left(text, 1), "", "1", "1")
Loop
code = code Mod 255
akey.value = code
Junk = SetTimeOut(ID, 1)
End Function
Function Encrypt
Alph = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
text = boxa.value
code = ""
key = Int(akey.value)
Do Until text = ""
cnum = Asc(Left(text, 1))
cnum = (cnum+key) Mod 255
num = cnum Mod 26
count = 0
tst = num
Do Until tst = cnum
tst = tst+26
count = count+1
Loop
code = code & alph(num) & count
text = Replace(text, Left(text, 1), "", "1", "1")
Loop
boxa.value = code
End Function
Function Decrypt
Alph = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
text = boxa.value
code = ""
key = Int(akey.value)
Do Until text = ""
lttr = Left(text, 2)
num = Asc(Left(lttr, 1))-65
chk = Right(lttr, 1)
count = 0
Do Until count = Int(chk)
num = num+26
count = count+1
Loop
num = num-key
Do While num <= 0
num = num+255
Loop
Code = code & Chr(num)
text = Replace(text, Left(text, 2), "", "1", "1")
Loop
boxa.value = code
End Function
</script>
<body bgcolor="white">
<input type="hidden" id="akey">
<table align="center" width="400">
<caption><hr><b>TEXT SECURE</b><hr></caption>
<tr>
<td align="center">Password: <input type="password" id="pswd"></td>
</tr>
<tr>
<td align="center"><input style="width: 410px; height:30px;" type="button" Value="Encrypt" id="BTNE" onClick="Validate('Encrypt')" onmouseover="BTNE.style.background='#303030'" onmouseout="BTNE.style.background='#101010'"></td>
</tr>
<tr>
<td align="center"><input style="width: 410px; height:30px;" type="button" Value="Decrypt" id="BTND" onClick="Validate('Decrypt')" onmouseover="BTND.style.background='#303030'" onmouseout="BTND.style.background='#101010'"></td>
</tr>
<tr>
<td align="center"><textarea id="boxa" cols="50" rows="10"></textarea></td>
</tr>
<tr>
<td align="right"><span style="font-size: 10px;">Copyright © 2013</span> | <span style="font-size: 10px;">By - KN Network</span></td>
</tr>
</table>
</body>
</html>
2. Save as
TextSecure.hta. You can name it anything but remember to include the .hta
extension while saving.
3. Open the program,
enter the text or code and password and click encrypt or decrypt.
Here is a sample code
from the program.
Original text: Anantheesan
Encrypted text: P6I8V7I8O8C8Z7Z7N8V7I8
No comments:
Post a Comment