Hello all. Anyone have a simple VBScript that will take input and
encrypt it and/or decrypt it?

Re: simple text encrypt / decrypt by McKirahan

McKirahan
Tue Mar 15 11:00:38 CST 2005

<emebohw@netscape.net> wrote in message
news:1110902944.815644.12700@o13g2000cwo.googlegroups.com...
> Hello all. Anyone have a simple VBScript that will take input and
> encrypt it and/or decrypt it?
>

Will this help? Watch for word-wrap.

Clicking "encrypt" changes "abc" to "bcd" then
clicking "decrypt" changes "bcd" back to "abc".

This includes a JavaScript version as well.

<html>
<head>
<title>endecrypt.htm</title>
<script type="text/javascript">
function endecrypt_js(bool) {
var char, code, diff=1, temp="";
var text = document.getElementById("text").value;
for (var i=0; i<text.length; i++) {
char = text.charCodeAt(i);
(bool) ? code=char+diff : code=char-diff;
temp += String.fromCharCode(code);
}
document.getElementById("text").value = temp;
}
</script>
<script type="text/vbscript">
Function endecrypt_vbs(bool)
Const diff = 1
Dim char, code, i, temp, text
temp = ""
text = document.getElementById("text").value
For i = 1 To Len(text)
char = Asc(Mid(text,i,1))
If bool Then
code = char + diff
Else
code = char - diff
End If
temp = temp & Chr(code)
Next
document.getElementById("text").value = temp
End Function
</script>
</head>
<body>
<form>
<input type="text" name="text" id="text">
<br><input type="button" value="encrypt JS" onclick="endecrypt_js(true)">
<br><input type="button" value="decrypt JS" onclick="endecrypt_js(false)">
<br><input type="button" value="encrypt VBS" onclick="endecrypt_vbs(true)">
<br><input type="button" value="decrypt VBS" onclick="endecrypt_vbs(false)">
</form>
</body>
</html>



Re: simple text encrypt / decrypt by emebohw

emebohw
Tue Mar 15 14:30:54 CST 2005

Hi! Thats exactly the kind of thing I am looking for, but with a little
more "mix" to how the text gets rearranged. Any thoughts on how to
increase the complexity of the "mix"?


Re: simple text encrypt / decrypt by McKirahan

McKirahan
Tue Mar 15 14:35:53 CST 2005

<emebohw@netscape.net> wrote in message
news:1110918654.747410.265030@g14g2000cwa.googlegroups.com...
> Hi! Thats exactly the kind of thing I am looking for, but with a little
> more "mix" to how the text gets rearranged. Any thoughts on how to
> increase the complexity of the "mix"?
>

Sure but then it wouldn't be "simple".

Google "VBScript encryption".



Re: simple text encrypt / decrypt by emebohw

emebohw
Tue Mar 15 14:44:38 CST 2005

Actually, now that I have tried to run it, I cant get it to work. I
dont think word wrap is an issue, it works for you?


Re: simple text encrypt / decrypt by emebohw

emebohw
Tue Mar 15 14:44:40 CST 2005

Actually, now that I have tried to run it, I cant get it to work. I
dont think word wrap is an issue, it works for you?


Re: simple text encrypt / decrypt by McKirahan

McKirahan
Tue Mar 15 15:06:28 CST 2005

<emebohw@netscape.net> wrote in message
news:1110919480.695908.48140@g14g2000cwa.googlegroups.com...
> Actually, now that I have tried to run it, I cant get it to work. I
> dont think word wrap is an issue, it works for you?
>

Works fine for me. What happens for you?

What word/phrase are you using?

Insert Alert() statements to debug.

Try this VBS-only version.

<html>
<head>
<title>endecrypt.htm</title>
<script type="text/vbscript">
Function endecrypt(bool)
Const diff = 1
Dim char, code, i, temp, text
temp = ""
text = document.getElementById("text").value
For i = 1 To Len(text)
char = Asc(Mid(text,i,1))
If bool Then
code = char + diff
Else
code = char - diff
End If
temp = temp & Chr(code)
Next
document.getElementById("text").value = temp
End Function
</script>
</head>
<body>
<form>
<input type="text" name="text" id="text"><br>
<input type="button" value="encrypt" onclick="endecrypt(true)">
&nbsp; &nbsp;
<input type="button" value="decrypt" onclick="endecrypt(false)">
</form>
</body>
</html>



Re: simple text encrypt / decrypt by Alek

Alek
Tue Mar 15 18:46:04 CST 2005

I am not sure what you guys are trying to do here, but if you need real
encryption (not a pseudo-obfuscation which can be easily hacked), then you
need to use standard encryption algorithms (e.g. 3DES) via CAPI COM (COM
version of Crypto API), DPAPI (you would need to write a COM object to do
this), or similar methodology. And unless you used DPAPI or ACL-protected
key (like public key), you must protect the encryption key. This is not
easy, but if by encryption you want to achieve any level of security, you
should not be writing your own "encryption" algorithms.

Alek

<emebohw@netscape.net> wrote in message
news:1110902944.815644.12700@o13g2000cwo.googlegroups.com...
> Hello all. Anyone have a simple VBScript that will take input and
> encrypt it and/or decrypt it?
>



Re: simple text encrypt / decrypt by emebohw

emebohw
Thu Mar 17 08:43:13 CST 2005

Gee Alek, I think I indicated that McKirahan is trying to help me do
is exactly what I needed...so thanks for the unsolicited criticism.

<!> McKirahan <!>
I get a invalid character error on line [temp = ""] and then I get a
type mismatch error on like [<input type="text" name="text"
id="text"><br>]

This 'obfuscation' really is all I need to accomplish and I appreciate
your constructive help!


Re: simple text encrypt / decrypt by Alek

Alek
Thu Mar 17 11:40:24 CST 2005

Didn't mean to offend anyone.

Alek

<emebohw@netscape.net> wrote in message
news:1111070593.951148.106150@l41g2000cwc.googlegroups.com...
> Gee Alek, I think I indicated that McKirahan is trying to help me do
> is exactly what I needed...so thanks for the unsolicited criticism.
>
> <!> McKirahan <!>
> I get a invalid character error on line [temp = ""] and then I get a
> type mismatch error on like [<input type="text" name="text"
> id="text"><br>]
>
> This 'obfuscation' really is all I need to accomplish and I appreciate
> your constructive help!
>



Re: simple text encrypt / decrypt by McKirahan

McKirahan
Thu Mar 17 12:41:00 CST 2005

<emebohw@netscape.net> wrote in message
news:1111070593.951148.106150@l41g2000cwc.googlegroups.com...
> Gee Alek, I think I indicated that McKirahan is trying to help me do
> is exactly what I needed...so thanks for the unsolicited criticism.
>
> <!> McKirahan <!>
> I get a invalid character error on line [temp = ""] and then I get a
> type mismatch error on like [<input type="text" name="text"
> id="text"><br>]
>
> This 'obfuscation' really is all I need to accomplish and I appreciate
> your constructive help!

I saw this in the middle of a post:

<!> McKirahan <!>
I get a invalid character error on line [temp = ""] and then I get a
type mismatch error on like [<input type="text" name="text"
id="text"><br>]

Was it meant for me? Is there a problem?

If so, could you post your code?



Re: simple text encrypt / decrypt by Michael

Michael
Thu Mar 17 19:23:50 CST 2005

Alek Davis wrote:
> Didn't mean to offend anyone.


IMHO, your reply was neither offensive nor criticism ;-)...

In fact, I thought you quite justified in posting since the OP didn't
clarify that they wanted to obfuscate rather than encrypt/decrypt until he
replied to your post.


--
Michael Harris
Microsoft MVP Scripting
http://maps.google.com/maps?q=Sammamish%20WA%20US



Re: simple text encrypt / decrypt by Alek

Alek
Fri Mar 18 12:06:03 CST 2005

Thanks Michael. Feel a bit better. :-)

Alek

"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:eDDwgk1KFHA.3380@TK2MSFTNGP10.phx.gbl...
> Alek Davis wrote:
> > Didn't mean to offend anyone.
>
>
> IMHO, your reply was neither offensive nor criticism ;-)...
>
> In fact, I thought you quite justified in posting since the OP didn't
> clarify that they wanted to obfuscate rather than encrypt/decrypt until he
> replied to your post.
>
>
> --
> Michael Harris
> Microsoft MVP Scripting
> http://maps.google.com/maps?q=Sammamish%20WA%20US
>
>