1 Replies - 1382 Views - Last Post: 07 May 2013 - 10:08 AM Rate Topic: -----

#1 seanyp63  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-May 13

Simple .hta Encryption problem

Posted 07 May 2013 - 09:56 AM

This .hta problem is driving me crazy as I know I am close to solving it..

THIS IS NOT HOMEWORK

Make a better encryption program by changing the offset every letter. Use a loop of 5 ( add one two three four five then start over)
For example, for the message “Hello John”, add 1 to H, 2 to e, 3 to l, 4 to l, 5 to o, 1 to space, 2 to J, 3 to o, 4 to h, and 5 to n, giving: Igopt!Lrls

Thus, the same letter does not get transformed to the same character throughout the message.


Test message:
The rain in Spain falls mainly on the plain.
Output should be:
Ujh$wbkq$no"Vtfjp#jfmnv$rbkqp~!qq$yig#…

So Far, this is what I came up with
<HTML>
<HEAD><TITLE>Message Encryption</TITLE>
<script LANGUAGE="VBScript"> 
<!--
Sub Submit_onclick
Dim TheForm
Set TheForm = document.ValidForm


string1 = TheForm.input.Value
for i = 1 to len(string1)

string2 = string2 & chr(asc(mid(string1,i,1)) ++i)
next

TheForm.output.value = string2


End Sub
-->
</SCRIPT>
</HEAD>
<BODY>

<FORM NAME="ValidForm">
Enter your message here: 
<INPUT NAME="input" TYPE="TEXT" size=50> <br>
The encrypted message is: 
<input name="output" type="text" size=50><br><br>

<INPUT NAME="Submit" TYPE="BUTTON" VALUE="Encrypt">
</FORM>
</BODY>
</HTML>




However my encryption keeps going and I cannot figure out how to get the loop to work so it resets every 5 letters please let me know if anyone can help. Thanks!

This post has been edited by modi123_1: 07 May 2013 - 09:58 AM
Reason for edit:: fixed botched code tag


Is This A Good Question/Topic? 0
  • +

Replies To: Simple .hta Encryption problem

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3731
  • View blog
  • Posts: 13,044
  • Joined: 12-December 12

Re: Simple .hta Encryption problem

Posted 07 May 2013 - 10:08 AM

VBScript does not have the increment ++ operator.

How is this not homework, or an assignment..?

Quote

Make a better encryption program ..

reads exactly like homework.

This post has been edited by andrewsw: 07 May 2013 - 10:10 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1