Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11818 > unrolled thread

Decode-email

Started by"Mayayana" <mayayana@invalid.nospam>
First post2018-02-15 20:09 -0500
Last post2018-02-18 16:41 -0500
Articles 20 on this page of 42 — 4 participants

Back to article view | Back to microsoft.public.scripting.vbscript


Contents

  Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-15 20:09 -0500
    Re: Decode-email GS <gs@v.invalid> - 2018-02-15 22:52 -0500
      Re: Decode-email GS <gs@v.invalid> - 2018-02-15 23:02 -0500
      Re: Decode-email GS <gs@v.invalid> - 2018-02-15 23:34 -0500
      Re: Decode-email GS <gs@v.invalid> - 2018-02-16 00:44 -0500
        Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-16 09:46 -0500
          Re: Decode-email JJ <jj4public@vfemail.net> - 2018-02-17 22:00 +0700
    Re: Decode-email JJ <jj4public@vfemail.net> - 2018-02-17 01:46 +0700
      Re: Decode-email GS <gs@v.invalid> - 2018-02-16 15:30 -0500
        Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-17 09:29 -0500
        Re: Decode-email JJ <jj4public@vfemail.net> - 2018-02-17 21:47 +0700
          Re: Decode-email GS <gs@v.invalid> - 2018-02-17 19:51 -0500
            Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-17 20:33 -0500
              Re: Decode-email GS <gs@v.invalid> - 2018-02-17 21:40 -0500
                Re: Decode-email GS <gs@v.invalid> - 2018-02-17 21:43 -0500
                Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-17 22:57 -0500
                  Re: Decode-email GS <gs@v.invalid> - 2018-02-17 23:10 -0500
                    Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-17 23:18 -0500
                      Re: Decode-email GS <gs@v.invalid> - 2018-02-17 23:41 -0500
                        Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-18 10:23 -0500
                          Re: Decode-email GS <gs@v.invalid> - 2018-02-18 10:38 -0500
                            Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-18 11:09 -0500
                              Re: Decode-email GS <gs@v.invalid> - 2018-02-18 13:20 -0500
            Re: Decode-email JJ <jj4public@vfemail.net> - 2018-02-18 09:47 +0700
              Re: Decode-email GS <gs@v.invalid> - 2018-02-17 21:50 -0500
      Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-16 18:43 -0500
        Re: Decode-email GS <gs@v.invalid> - 2018-02-16 20:06 -0500
          Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-16 23:18 -0500
            Re: Decode-email GS <gs@v.invalid> - 2018-02-16 23:32 -0500
            Re: Decode-email GS <gs@v.invalid> - 2018-02-17 00:00 -0500
              Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-17 09:24 -0500
                Re: Decode-email "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-02-17 16:07 +0100
                  Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-17 10:46 -0500
                    Re: Decode-email "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-02-17 18:18 +0100
                Re: Decode-email GS <gs@v.invalid> - 2018-02-17 21:46 -0500
                  Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-17 23:09 -0500
                    Re: Decode-email GS <gs@v.invalid> - 2018-02-17 23:13 -0500
                    Re: Decode-email GS <gs@v.invalid> - 2018-02-17 23:23 -0500
                      Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-18 10:32 -0500
                        Re: Decode-email GS <gs@v.invalid> - 2018-02-18 10:41 -0500
                          Re: Decode-email "Mayayana" <mayayana@invalid.nospam> - 2018-02-18 16:30 -0500
                            Re: Decode-email GS <gs@v.invalid> - 2018-02-18 16:41 -0500

Page 2 of 3 — ← Prev page 1 [2] 3  Next page →


#11864

FromGS <gs@v.invalid>
Date2018-02-18 10:38 -0500
Message-ID<p6c6kr$kmh$1@dont-email.me>
In reply to#11862
> "GS" <gs@v.invalid> wrote
>
>> SMA.exe allows a user to compose text and encrypt it, then inserts the
>> encrypted text for them, but they must copy/paste to decrypt. It's  
>> basically for sending/receiving file open passwords, but it's always been 
>> how I've received/sent license keys for my apps. Now my clients can do 
>> similar with anyone who has SMA.exe. I haven't officially commercialized it 
>> yet, but  it's ready for that if it takes off.
>> 
>   That's a good idea. Encryption without the
> drawbacks of TLS. But.... what is NIC? 

PairNic is their domain registry dept.

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11866

From"Mayayana" <mayayana@invalid.nospam>
Date2018-02-18 11:09 -0500
Message-ID<p6c8gd$2gt$1@dont-email.me>
In reply to#11864
"GS" <gs@v.invalid> wrote
| PairNic is their domain registry dept.
|

  Oh. I get it. Thanks. I've been paying about
$20/year to Netsol. I guess I'm probably being
cheated, but I just didn't trust a company
that charges almost nothing. As Martin
Mull said, "white people like to buy retail." :) 

[toc] | [prev] | [next] | [standalone]


#11867

FromGS <gs@v.invalid>
Date2018-02-18 13:20 -0500
Message-ID<p6cg4n$t2j$1@dont-email.me>
In reply to#11866
> "GS" <gs@v.invalid> wrote
>> PairNic is their domain registry dept.
>> 
>
>   Oh. I get it. Thanks. I've been paying about
> $20/year to Netsol. I guess I'm probably being
> cheated, but I just didn't trust a company
> that charges almost nothing. As Martin
> Mull said, "white people like to buy retail." :) 

Well, if you're talking about the likes of 'GoDaddy', I agree. I've heard 
horror stories about some SPs that would shock you!

PairNetworks is definitely not one of those! I was paying considerably more 
initially (higher level 'package') but got the opportunity to switch over to 
their new server at a much better price. Since this server doesn't support 
Frontpage Extensions, I had to come up with my own email script for my contact 
form page. Otherwise, it's a great SP and I'd recommend them highly to anyone!

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11853

FromJJ <jj4public@vfemail.net>
Date2018-02-18 09:47 +0700
Message-ID<nhomef7mf6b$.13jp3bj775jqt$.dlg@40tude.net>
In reply to#11848
On Sat, 17 Feb 2018 19:51:51 -0500, GS wrote:
> This new code throws a typemismatch error when decoding running with your 
> original usage example!

Which line?

[toc] | [prev] | [next] | [standalone]


#11854

FromGS <gs@v.invalid>
Date2018-02-17 21:50 -0500
Message-ID<p6apku$gu0$1@dont-email.me>
In reply to#11853
> On Sat, 17 Feb 2018 19:51:51 -0500, GS wrote:
>> This new code throws a typemismatch error when decoding running with your 
>> original usage example!
>
> Which line?

Sorry friend, my mistake in not copying the decode function to the new file. (I 
keep originals until no longer valid)

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11836

From"Mayayana" <mayayana@invalid.nospam>
Date2018-02-16 18:43 -0500
Message-ID<p67qbo$kag$1@dont-email.me>
In reply to#11832
"JJ" <jj4public@vfemail.net> wrote

| You might be interrested on CloudFlare's encrypted email.

  Cloudflare is the one I wrote it for. Though I'd
guess there may be other sites using it. I had
to figure it out by tracking the values as the
loop ran.

[toc] | [prev] | [next] | [standalone]


#11837

FromGS <gs@v.invalid>
Date2018-02-16 20:06 -0500
Message-ID<p67v6u$euc$1@dont-email.me>
In reply to#11836
> "JJ" <jj4public@vfemail.net> wrote
>
>> You might be interrested on CloudFlare's encrypted email.
>
>   Cloudflare is the one I wrote it for. Though I'd
> guess there may be other sites using it. I had
> to figure it out by tracking the values as the
> loop ran.

I'm thinking they use their own proprietary version since a generic version 
would be too easy to hack. More likely that Perl(1) or PHP(2) is used!

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11838

From"Mayayana" <mayayana@invalid.nospam>
Date2018-02-16 23:18 -0500
Message-ID<p68aec$4gu$1@dont-email.me>
In reply to#11837
"GS" <gs@v.invalid> wrote

| >> You might be interrested on CloudFlare's encrypted email.
| >
| >   Cloudflare is the one I wrote it for. Though I'd
| > guess there may be other sites using it. I had
| > to figure it out by tracking the values as the
| > loop ran.
|
| I'm thinking they use their own proprietary version since a generic 
version
| would be too easy to hack. More likely that Perl(1) or PHP(2) is used!
|
  No, they're using javascript. It's a popular, small script
that's available online:
  http://codegists.com/snippet/javascript/email-decodeminjs_zhanglianxin_javascript

  Nobody does proprietary. :) Most webmasters don't
knw how to write code. They just use stuff others
have written. If you pull in the various script llibraries
used by big websites you'll usually see things like
an MIT license and author info in them.

  The way I worked out the code was to run the
link to the javascript file in the source code, get
that into the browser, and copy it. What surprises
me is how complex it is. There's no concern with
hacking. They'd need something a lot more fancy
for that.

 I think I figured out why some numbers don't work.
I'm curious how you found the range that fails. In
any case, I tried 44, in one of the ranges you noted
didn't work. Then I looked at the result and realized
that the problem was a single-character hex code.
A period is 46. 44 xor 46 is 2. That results in all following
characters being misread. But it can be fixed by adding a 0.

s2 = Hex(iKey)
For i = 1 to Len(sEmail)
    iVal = Asc(Mid(sEmail, i, 1))
    iVal = iVal XOR iKey
   '-- make sure a 0 is prepended if Hex result is only one character.
    s2 = s2 & Right( "00" & Hex(iVal), 2)
 Next

[toc] | [prev] | [next] | [standalone]


#11839

FromGS <gs@v.invalid>
Date2018-02-16 23:32 -0500
Message-ID<p68b8t$9kh$1@dont-email.me>
In reply to#11838
> "GS" <gs@v.invalid> wrote
>
>>>> You might be interrested on CloudFlare's encrypted email.
>>> 
>>>   Cloudflare is the one I wrote it for. Though I'd
>>> guess there may be other sites using it. I had
>>> to figure it out by tracking the values as the
>>> loop ran.
>> 
>> I'm thinking they use their own proprietary version since a generic  version
>> would be too easy to hack. More likely that Perl(1) or PHP(2) is used!
>> 
>   No, they're using javascript. It's a popular, small script
> that's available online:
>   
> http://codegists.com/snippet/javascript/email-decodeminjs_zhanglianxin_javascript
>
>   Nobody does proprietary. :) Most webmasters don't
> knw how to write code. They just use stuff others
> have written. If you pull in the various script llibraries
> used by big websites you'll usually see things like
> an MIT license and author info in them.
>
>   The way I worked out the code was to run the
> link to the javascript file in the source code, get
> that into the browser, and copy it. What surprises
> me is how complex it is. There's no concern with
> hacking. They'd need something a lot more fancy
> for that.
>
>  I think I figured out why some numbers don't work.
> I'm curious how you found the range that fails. In
> any case, I tried 44, in one of the ranges you noted
> didn't work. Then I looked at the result and realized
> that the problem was a single-character hex code.
> A period is 46. 44 xor 46 is 2. That results in all following
> characters being misread. But it can be fixed by adding a 0.
>
> s2 = Hex(iKey)
> For i = 1 to Len(sEmail)
>     iVal = Asc(Mid(sEmail, i, 1))
>     iVal = iVal XOR iKey
>    '-- make sure a 0 is prepended if Hex result is only one character.
>     s2 = s2 & Right( "00" & Hex(iVal), 2)
>  Next

I tested each 2 digit possibility. I'll modify your code with this update and 
redo the tests...

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11840

FromGS <gs@v.invalid>
Date2018-02-17 00:00 -0500
Message-ID<p68csu$hek$1@dont-email.me>
In reply to#11838
The following 2 digit combos still don't work:

  00 thru 15

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11841

From"Mayayana" <mayayana@invalid.nospam>
Date2018-02-17 09:24 -0500
Message-ID<p69duk$eg7$1@dont-email.me>
In reply to#11840
"GS" <gs@v.invalid> wrote in message news:p68csu$hek$1@dont-email.me...
| The following 2 digit combos still don't work:
|
|  00 thru 15
|
  Boy, you're thorough. :)

It turns out that's the same problem. If the key is under
16 then the hex version is only one character:
14 = E. 16 = 10

 Thus, starting the encoded string with the hex version
of the key must also check to see whether it needs a
zero prepended.

[toc] | [prev] | [next] | [standalone]


#11845

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2018-02-17 16:07 +0100
Message-ID<XnsA88CA4059B61Feejj99@194.109.6.166>
In reply to#11841
"Mayayana" <mayayana@invalid.nospam> wrote on 17 Feb 2018 in 
microsoft.public.scripting.vbscript:

> "GS" <gs@v.invalid> wrote in message news:p68csu$hek$1@dont-email.me...
>| The following 2 digit combos still don't work:
>|
>|  00 thru 15
>|
>   Boy, you're thorough. :)
> 
> It turns out that's the same problem. If the key is under
> 16 then the hex version is only one character:
> 14 = E. 16 = 10
> 
>  Thus, starting the encoded string with the hex version
> of the key must also check to see whether it needs a
> zero prepended.

Check?

h = right("0" & h, 2) 

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#11846

From"Mayayana" <mayayana@invalid.nospam>
Date2018-02-17 10:46 -0500
Message-ID<p69ip7$evm$1@dont-email.me>
In reply to#11845
"Evertjan." <exxjxw.hannivoort@inter.nl.net> wrote

| h = right("0" & h, 2)
|

 Yes. See the other posts. That was already settled.

  Though I like to use an extra "0". I know that it
works to do Right("00", 2) but I like to build a string
that's longer than necessary, just to be sure there
are always 2 characters to get. Perhaps more
superstition than logic, but it's harmless. 

[toc] | [prev] | [next] | [standalone]


#11847

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2018-02-17 18:18 +0100
Message-ID<XnsA88CBA2F29A51eejj99@194.109.6.166>
In reply to#11846
"Mayayana" <mayayana@invalid.nospam> wrote on 17 Feb 2018 in 
microsoft.public.scripting.vbscript:

> "Evertjan." <exxjxw.hannivoort@inter.nl.net> wrote
> 
>| h = right("0" & h, 2)
>|
> 
>  Yes. See the other posts. That was already settled.

I saw later posts that "settled" for 5 or more lines of code.

>   Though I like to use an extra "0". I know that it
> works to do Right("00", 2) but I like to build a string
> that's longer than necessary, just to be sure there
> are always 2 characters to get. Perhaps more
> superstition than logic, but it's harmless. 

I don't think such superstition is harmless,
better build your code by analyzing,
and if the input is a hex number string[!] <= FF and >= 0,
then ...


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#11852

FromGS <gs@v.invalid>
Date2018-02-17 21:46 -0500
Message-ID<p6apek$fqk$1@dont-email.me>
In reply to#11841
> "GS" <gs@v.invalid> wrote in message news:p68csu$hek$1@dont-email.me...
>> The following 2 digit combos still don't work:
>> 
>>  00 thru 15
>> 
>   Boy, you're thorough. :)
>
> It turns out that's the same problem. If the key is under
> 16 then the hex version is only one character:
> 14 = E. 16 = 10
>
>  Thus, starting the encoded string with the hex version
> of the key must also check to see whether it needs a
> zero prepended.

So then your version needs to work like JJ's?

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11856

From"Mayayana" <mayayana@invalid.nospam>
Date2018-02-17 23:09 -0500
Message-ID<p6au9v$4ri$1@dont-email.me>
In reply to#11852
"GS" <gs@v.invalid> wrote

| So then your version needs to work like JJ's?
|

  Yes. Didn't you see my later post? The key needs
to be checked to be sure it's 2 characters when it's
written to the encoding. Then each conversion needs
to be 2 characters. There was never any problem
with the basic routine. There was just that glitch.

  I wonder what bright bulb at CloudFlare thought
that mess was a good idea. It's a pain in the neck
for no reason. It doesn't need to be so complex to
stop bots. There's no reason to try to lock the email
from visitors. And that method is not secure, anyway.
The only possible purpose I can think of would be
to make the site break if people don't enable script.

  But there is one truism that always holds in
tech: People are impressed by obfuscation and
abstruseness. The reason may be no more than
that. someone thought it was clever to encode
an email address in a *wicked* long string. :) 

[toc] | [prev] | [next] | [standalone]


#11858

FromGS <gs@v.invalid>
Date2018-02-17 23:13 -0500
Message-ID<p6augu$5rs$1@dont-email.me>
In reply to#11856
>> So then your version needs to work like JJ's?
>>  
>
>   Yes. Didn't you see my later post? The key needs
> to be checked to be sure it's 2 characters when it's
> written to the encoding. Then each conversion needs
> to be 2 characters. There was never any problem
> with the basic routine. There was just that glitch.

Well that's the version I have now that still doesn't work for combos 00-15. 
Did I miss a revised posting?

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11860

FromGS <gs@v.invalid>
Date2018-02-17 23:23 -0500
Message-ID<p6av3a$9hm$1@dont-email.me>
In reply to#11856
> "GS" <gs@v.invalid> wrote
>
>> So then your version needs to work like JJ's?
>> 
>
>   Yes. Didn't you see my later post? The key needs
> to be checked to be sure it's 2 characters when it's
> written to the encoding. Then each conversion needs
> to be 2 characters. There was never any problem
> with the basic routine. There was just that glitch.
>
>   I wonder what bright bulb at CloudFlare thought
> that mess was a good idea. It's a pain in the neck
> for no reason. It doesn't need to be so complex to
> stop bots. There's no reason to try to lock the email
> from visitors. And that method is not secure, anyway.
> The only possible purpose I can think of would be
> to make the site break if people don't enable script.
>
>   But there is one truism that always holds in
> tech: People are impressed by obfuscation and
> abstruseness. The reason may be no more than
> that. someone thought it was clever to encode
> an email address in a *wicked* long string. :) 

I'm testing...

  me@me.com

..with 2 digits appended using this script to encode:

' EncodeEmail.vbs
' by Mayayana 2/15/2018
'---------------------- begin encoder script ---------


Dim s, sEmail, sKey, s2, i, iKey, iVal

s = InputBox("Enter email address to encode. Follow that with a 2-digit key for 
encoding", "Email address encoder")
    If Len(s) = 0 Then WScript.quit

  On Error Resume Next
s = Replace(s, " ", "")
sEmail = Left(s, len(s) - 2)
sKey = Right(s, 2)
iKey = cbyte(sKey)
  If Err.number <> 0 Then
     MsgBox "Error in entering email and encryption key."
     WScript.Quit
   End If

s2 = Hex(iKey)
For i = 1 to Len(sEmail)
    iVal = Asc(Mid(sEmail, i, 1))
    iVal = iVal XOR iKey
    'Revised 2/16/2018
   '-- make sure a 0 is prepended if Hex result is only one character.
    s2 = s2 & Right( "00" & Hex(iVal), 2)
 Next

s = InputBox("Encoded email address:", "Encode email address", s2)
WScript.quit

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11863

From"Mayayana" <mayayana@invalid.nospam>
Date2018-02-18 10:32 -0500
Message-ID<p6c6ac$icf$1@dont-email.me>
In reply to#11860
"GS" <gs@v.invalid> wrote | I'm testing...
|
|  me@me.com
|
| ..with 2 digits appended using this script to encode:
|

I didn't repost the whole thing. Just the correction.
Here it is:

  Note that change#2 is what makes sure that all
hex renditions are 2 characters. Then I realized that
the problem with 0-15 was that they key was ending up
as one character. So 10, for example, would be A.
But it needs to be 0A in order to work because the\
script is parsing 2 characters at a time.

  So the line marked change#1 is what fixes that.
It's what Evertjan huffily derided as "more
than 5 lines of code". :)
  The first version went like so:
   s2 = Hex(iKey)
The correction, just before the loop starts, is:
  s2 = Right("00" & Hex(iKey), 2)

----------------------------------------
Dim s, sEmail, sKey, s2, i, iKey, iVal

s = InputBox("Enter email address to encode. Follow that with a 2-digit key 
for encoding", "Email address encoder")
    If Len(s) = 0 Then WScript.quit

  On Error Resume Next
s = Replace(s, " ", "")
sEmail = Left(s, len(s) - 2)
sKey = Right(s, 2)
iKey = cbyte(sKey)
  If Err.number <> 0 Then
     MsgBox "Error in entering email and encryption key."
     WScript.Quit
   End If

s2 = Right("00" & Hex(iKey), 2) 'change #1
For i = 1 to Len(sEmail)
    iVal = Asc(Mid(sEmail, i, 1))
    iVal = iVal XOR iKey
    s2 = s2 & Right( "00" & Hex(iVal), 2) 'change#2
 Next

s = InputBox("Encoded email address:", "Encode email address", s2)
WScript.quit


[toc] | [prev] | [next] | [standalone]


#11865

FromGS <gs@v.invalid>
Date2018-02-18 10:41 -0500
Message-ID<p6c6s3$mfd$1@dont-email.me>
In reply to#11863
> "GS" <gs@v.invalid> wrote | I'm testing...
>> 
>>  me@me.com
>> 
>> ..with 2 digits appended using this script to encode:
>> 
>
> I didn't repost the whole thing. Just the correction.
> Here it is:
>
>   Note that change#2 is what makes sure that all
> hex renditions are 2 characters. Then I realized that
> the problem with 0-15 was that they key was ending up
> as one character. So 10, for example, would be A.
> But it needs to be 0A in order to work because the\
> script is parsing 2 characters at a time.
>
>   So the line marked change#1 is what fixes that.
> It's what Evertjan huffily derided as "more
> than 5 lines of code". :)
>   The first version went like so:
>    s2 = Hex(iKey)
> The correction, just before the loop starts, is:
>   s2 = Right("00" & Hex(iKey), 2)
>
> ----------------------------------------
> Dim s, sEmail, sKey, s2, i, iKey, iVal
>
> s = InputBox("Enter email address to encode. Follow that with a 2-digit key 
> for encoding", "Email address encoder")
>     If Len(s) = 0 Then WScript.quit
>
>   On Error Resume Next
> s = Replace(s, " ", "")
> sEmail = Left(s, len(s) - 2)
> sKey = Right(s, 2)
> iKey = cbyte(sKey)
>   If Err.number <> 0 Then
>      MsgBox "Error in entering email and encryption key."
>      WScript.Quit
>    End If
>
> s2 = Right("00" & Hex(iKey), 2) 'change #1
> For i = 1 to Len(sEmail)
>     iVal = Asc(Mid(sEmail, i, 1))
>     iVal = iVal XOR iKey
>     s2 = s2 & Right( "00" & Hex(iVal), 2) 'change#2
>  Next
>
> s = InputBox("Encoded email address:", "Encode email address", s2)
> WScript.quit

Ah! I missed change#1
Thanks, it's been an adventure working this out with you!

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


Page 2 of 3 — ← Prev page 1 [2] 3  Next page →

Back to top | Article view | microsoft.public.scripting.vbscript


csiph-web