Hello, I was wondering if anyone can help me out with a VBscript. The file encry
ID: 3773874 • Letter: H
Question
Hello, I was wondering if anyone can help me out with a VBscript. The file encrypts and decrypts as it stands, but I wanted to change the algorithm to be mine. Can you show me how/where to change the values in the code? For example, I want to shift the characters over to the right by 5 when I encrypt and decrypt. Any help is very much appreciated. Here is the code:<html> <head> <title>Cryptography Practice</title> <HTA:APPLICATION APPLICATIONNAME="Cryptography Practice" MAXIMIZEBUTTON="no" SCROLL="no" SysMenu="yes" ID="Cryptography Practice"/> </head> <style> body {background-color: #white; color: #000; border:5px solid #000; margin-right:auto; margin-left:auto;}
h1 {font-size:18px;} input {background-color: #bfbfbf; color: #000;}
textarea {background-color: #fff; color: #000;} </style> <script language="VBScript">
Sub Window_OnLoad Dim width,height width=470 height=430 self.ResizeTo width,height End Sub
Function Validate(ID) On Error Resume Next Key = Int(thepass.value) If (thepass.value = "") Then X = MsgBox("Password not entered.", 32, "Opps, something went wrong!") Else If (chatbox.value = "") Then X = MsgBox("Please enter text to encrypt or decrypt.", 32, "Opps, something went wrong!") Else Junk = SetTimeOut(KEYS(ID), 1) End If End If End Function
Function KEYS(ID) text = thepass.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 thekey.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.value = code End Function
</script>
<body bgcolor="white"> <input type="hidden" id="thekey"> <table align="center" width="400"> <strong><caption><h1>Cryptography Practice</h1></caption></strong> <tr> <td align="center">Enter Your Password: <input type="password" id="thepass"></td> </tr> <tr> <td align="center"><textarea id="chatbox" cols="50" rows="10"></textarea></td> </tr>
<tr align="center"> <td> <input type="button" Value="encrypt" id="BTNE"/> <input type="button" Value="decrypt" id="BTND"/> </td> </tr>
</table> </body> </html>
Hello, I was wondering if anyone can help me out with a VBscript. The file encrypts and decrypts as it stands, but I wanted to change the algorithm to be mine. Can you show me how/where to change the values in the code? For example, I want to shift the characters over to the right by 5 when I encrypt and decrypt. Any help is very much appreciated. Here is the code:
<html> <head> <title>Cryptography Practice</title> <HTA:APPLICATION APPLICATIONNAME="Cryptography Practice" MAXIMIZEBUTTON="no" SCROLL="no" SysMenu="yes" ID="Cryptography Practice"/> </head> <style> body {background-color: #white; color: #000; border:5px solid #000; margin-right:auto; margin-left:auto;}
h1 {font-size:18px;} input {background-color: #bfbfbf; color: #000;}
textarea {background-color: #fff; color: #000;} </style> <script language="VBScript">
Sub Window_OnLoad Dim width,height width=470 height=430 self.ResizeTo width,height End Sub
Function Validate(ID) On Error Resume Next Key = Int(thepass.value) If (thepass.value = "") Then X = MsgBox("Password not entered.", 32, "Opps, something went wrong!") Else If (chatbox.value = "") Then X = MsgBox("Please enter text to encrypt or decrypt.", 32, "Opps, something went wrong!") Else Junk = SetTimeOut(KEYS(ID), 1) End If End If End Function
Function KEYS(ID) text = thepass.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 thekey.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.value = code End Function
</script>
<body bgcolor="white"> <input type="hidden" id="thekey"> <table align="center" width="400"> <strong><caption><h1>Cryptography Practice</h1></caption></strong> <tr> <td align="center">Enter Your Password: <input type="password" id="thepass"></td> </tr> <tr> <td align="center"><textarea id="chatbox" cols="50" rows="10"></textarea></td> </tr>
<tr align="center"> <td> <input type="button" Value="encrypt" id="BTNE"/> <input type="button" Value="decrypt" id="BTND"/> </td> </tr>
</table> </body> </html>
Hello, I was wondering if anyone can help me out with a VBscript. The file encrypts and decrypts as it stands, but I wanted to change the algorithm to be mine. Can you show me how/where to change the values in the code? For example, I want to shift the characters over to the right by 5 when I encrypt and decrypt. Any help is very much appreciated. Here is the code:
<html> <head> <title>Cryptography Practice</title> <HTA:APPLICATION APPLICATIONNAME="Cryptography Practice" MAXIMIZEBUTTON="no" SCROLL="no" SysMenu="yes" ID="Cryptography Practice"/> </head> <style> body {background-color: #white; color: #000; border:5px solid #000; margin-right:auto; margin-left:auto;}
h1 {font-size:18px;} input {background-color: #bfbfbf; color: #000;}
textarea {background-color: #fff; color: #000;} </style> <script language="VBScript">
Sub Window_OnLoad Dim width,height width=470 height=430 self.ResizeTo width,height End Sub
Function Validate(ID) On Error Resume Next Key = Int(thepass.value) If (thepass.value = "") Then X = MsgBox("Password not entered.", 32, "Opps, something went wrong!") Else If (chatbox.value = "") Then X = MsgBox("Please enter text to encrypt or decrypt.", 32, "Opps, something went wrong!") Else Junk = SetTimeOut(KEYS(ID), 1) End If End If End Function
Function KEYS(ID) text = thepass.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 thekey.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.value = code End Function
</script>
<body bgcolor="white"> <input type="hidden" id="thekey"> <table align="center" width="400"> <strong><caption><h1>Cryptography Practice</h1></caption></strong> <tr> <td align="center">Enter Your Password: <input type="password" id="thepass"></td> </tr> <tr> <td align="center"><textarea id="chatbox" cols="50" rows="10"></textarea></td> </tr>
<tr align="center"> <td> <input type="button" Value="encrypt" id="BTNE"/> <input type="button" Value="decrypt" id="BTND"/> </td> </tr>
</table> </body> </html>
<html> <head> <title>Cryptography Practice</title> <HTA:APPLICATION APPLICATIONNAME="Cryptography Practice" MAXIMIZEBUTTON="no" SCROLL="no" SysMenu="yes" ID="Cryptography Practice"/> </head> <style> body {background-color: #white; color: #000; border:5px solid #000; margin-right:auto; margin-left:auto;}
h1 {font-size:18px;} input {background-color: #bfbfbf; color: #000;}
textarea {background-color: #fff; color: #000;} </style> <script language="VBScript">
Sub Window_OnLoad Dim width,height width=470 height=430 self.ResizeTo width,height End Sub
Function Validate(ID) On Error Resume Next Key = Int(thepass.value) If (thepass.value = "") Then X = MsgBox("Password not entered.", 32, "Opps, something went wrong!") Else If (chatbox.value = "") Then X = MsgBox("Please enter text to encrypt or decrypt.", 32, "Opps, something went wrong!") Else Junk = SetTimeOut(KEYS(ID), 1) End If End If End Function
Function KEYS(ID) text = thepass.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 thekey.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.value = code End Function
</script>
<body bgcolor="white"> <input type="hidden" id="thekey"> <table align="center" width="400"> <strong><caption><h1>Cryptography Practice</h1></caption></strong> <tr> <td align="center">Enter Your Password: <input type="password" id="thepass"></td> </tr> <tr> <td align="center"><textarea id="chatbox" cols="50" rows="10"></textarea></td> </tr>
<tr align="center"> <td> <input type="button" Value="encrypt" id="BTNE"/> <input type="button" Value="decrypt" id="BTND"/> </td> </tr>
</table> </body> </html>
<html> <head> <title>Cryptography Practice</title> <HTA:APPLICATION APPLICATIONNAME="Cryptography Practice" MAXIMIZEBUTTON="no" SCROLL="no" SysMenu="yes" ID="Cryptography Practice"/> </head> <style> body {background-color: #white; color: #000; border:5px solid #000; margin-right:auto; margin-left:auto;}
h1 {font-size:18px;} input {background-color: #bfbfbf; color: #000;}
textarea {background-color: #fff; color: #000;} </style> <script language="VBScript">
Sub Window_OnLoad Dim width,height width=470 height=430 self.ResizeTo width,height End Sub
Function Validate(ID) On Error Resume Next Key = Int(thepass.value) If (thepass.value = "") Then X = MsgBox("Password not entered.", 32, "Opps, something went wrong!") Else If (chatbox.value = "") Then X = MsgBox("Please enter text to encrypt or decrypt.", 32, "Opps, something went wrong!") Else Junk = SetTimeOut(KEYS(ID), 1) End If End If End Function
Function KEYS(ID) text = thepass.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 thekey.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.value = code End Function
</script>
<body bgcolor="white"> <input type="hidden" id="thekey"> <table align="center" width="400"> <strong><caption><h1>Cryptography Practice</h1></caption></strong> <tr> <td align="center">Enter Your Password: <input type="password" id="thepass"></td> </tr> <tr> <td align="center"><textarea id="chatbox" cols="50" rows="10"></textarea></td> </tr>
<tr align="center"> <td> <input type="button" Value="encrypt" id="BTNE"/> <input type="button" Value="decrypt" id="BTND"/> </td> </tr>
</table> </body> </html> <html> <head> <title>Cryptography Practice</title> <HTA:APPLICATION APPLICATIONNAME="Cryptography Practice" MAXIMIZEBUTTON="no" SCROLL="no" SysMenu="yes" ID="Cryptography Practice"/> </head> <style> body {background-color: #white; color: #000; border:5px solid #000; margin-right:auto; margin-left:auto;}
h1 {font-size:18px;} input {background-color: #bfbfbf; color: #000;}
textarea {background-color: #fff; color: #000;} </style> <script language="VBScript">
Sub Window_OnLoad Dim width,height width=470 height=430 self.ResizeTo width,height End Sub
Function Validate(ID) On Error Resume Next Key = Int(thepass.value) If (thepass.value = "") Then X = MsgBox("Password not entered.", 32, "Opps, something went wrong!") Else If (chatbox.value = "") Then X = MsgBox("Please enter text to encrypt or decrypt.", 32, "Opps, something went wrong!") Else Junk = SetTimeOut(KEYS(ID), 1) End If End If End Function
Function KEYS(ID) text = thepass.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 thekey.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.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 = chatbox.value code = "" key = Int(thekey.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 chatbox.value = code End Function
</script>
<body bgcolor="white"> <input type="hidden" id="thekey"> <table align="center" width="400"> <strong><caption><h1>Cryptography Practice</h1></caption></strong> <tr> <td align="center">Enter Your Password: <input type="password" id="thepass"></td> </tr> <tr> <td align="center"><textarea id="chatbox" cols="50" rows="10"></textarea></td> </tr>
<tr align="center"> <td> <input type="button" Value="encrypt" id="BTNE"/> <input type="button" Value="decrypt" id="BTND"/> </td> </tr>
</table> </body> </html>
Explanation / Answer
<html>
<head>
<title>Cryptography Practice</title>
<HTA:APPLICATION
APPLICATIONNAME="Cryptography Practice"
MAXIMIZEBUTTON="no"
SCROLL="no"
SysMenu="yes"
ID="Cryptography Practice"/>
</head>
<style>
body {background-color: #white;
color: #000;
border:5px solid #000;
margin-right:auto;
margin-left:auto;}
h1 {font-size:18px;}
input {background-color: #bfbfbf;
color: #000;}
textarea {background-color: #fff;
color: #000;}
</style>
<script language="VBScript">
Sub Window_OnLoad
Dim width,height
width=470
height=430
self.ResizeTo width,height
End Sub
Function Validate(ID)
On Error Resume Next
Key = Int(thepass.value)
If (thepass.value = "") Then
X = MsgBox("Password not entered.", 32, "Opps, something went wrong!")
Else If (chatbox.value = "") Then
X = MsgBox("Please enter text to encrypt or decrypt.", 32, "Opps, something went wrong!")
Else
Junk = SetTimeOut(KEYS(ID), 1)
End If
End If
End Function
Function KEYS(ID)
text = thepass.value
code = 0
Do Until text = ""
code = ((Asc(Left(text, 5)))+code) // replace 1 by 5
text = Replace(text, Left(text, 5), "", "1", "1") // replace 1 by 5 for shifting
Loop
code = code Mod 255
thekey.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 = chatbox.value
code = ""
key = Int(thekey.value)
Do Until text = ""
cnum = Asc(Left(text, 5)) // replace 1 by 5
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, 5), "", "1", "1") // replace 1 by 5
Loop
chatbox.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 = chatbox.value
code = ""
key = Int(thekey.value)
Do Until text = ""
lttr = Left(text, 5) // replace 1 by 5
num = Asc(Left(lttr, 5))-65 // replace 1 by 5
chk = Right(lttr, 5) // replace 1 by 5
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, 5), "", "1", "1") // replace 1 by 5
Loop
chatbox.value = code
End Function
</script>
<body bgcolor="white">
<input type="hidden" id="thekey">
<table align="center" width="400">
<strong><caption><h1>Cryptography Practice</h1></caption></strong>
<tr>
<td align="center">Enter Your Password: <input type="password" id="thepass"></td>
</tr>
<tr>
<td align="center"><textarea id="chatbox" cols="50" rows="10"></textarea></td>
</tr>
<tr align="center">
<td>
<input type="button" Value="encrypt" id="BTNE"/>
<input type="button" Value="decrypt" id="BTND"/>
</td>
</tr>
</table>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.