HomeclosedFAQRegisterLog in

Share | 
 

 VBScript - How to make a text encryption program

Go down 
AuthorMessage
V1P3R
WhiteHat Support
WhiteHat Support
avatar

Posts : 76
White Hat Points : 202
White Hat Reputation : 10
Join date : 2013-07-30

PostSubject: VBScript - How to make a text encryption program    Thu Sep 05, 2013 11:53 am

[You must be registered and logged in to see this image.]

This is a simple HTML application which can encrypt and decrypt the text entered into a text box using the given key. The encryption algorithm is really simple and the output is in only uppercase alphabet letters and numbers. The drawback of the program is that it will double the length of the string when encrypting. Don't use this encryption program as the only source of security for important data.

To make the encryption program save the following code with .hta extension using notepad.

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 - #XByte</span></td>
</tr>
</table>
</body>
</html>

_________________
Mess with the Best, Die like the Rest
Back to top Go down
 
VBScript - How to make a text encryption program
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Home of Ethical White Hat Hackers :: Coded Sofwares & Malware Related :: Programming-
Jump to: