Home All Groups Group Topic Archive Search About

Internal String Visibility

Author
14 Mar 2009 12:50 AM
Lorin
I would like to garble a const string so that someone cannot search for and
change the string in the .exe easily.
Is here an easy way to generate the garbled string outside of the IDE to
copy into a const string, then ungarble it in the app when I am about to
display it?
VB6 app

Author
14 Mar 2009 1:02 AM
MikeD
"Lorin" <Lo***@discussions.microsoft.com> wrote in message
news:25A3FA53-4E01-40EC-BBC5-9FB25573F8DF@microsoft.com...
>I would like to garble a const string so that someone cannot search for and
> change the string in the .exe easily.
> Is here an easy way to generate the garbled string outside of the IDE to
> copy into a const string, then ungarble it in the app when I am about to
> display it?
> VB6 app


Use any kind of encryption. Your constant would be assigned the encrypted
string. When you need to use it, unencrypt it.

--
Mike
Author
14 Mar 2009 10:28 PM
Lorin
Which brings up another question.
Are all the MS encryption APIs on all Windows, foreign and domestic?


Show quoteHide quote
"MikeD" wrote:

>
> "Lorin" <Lo***@discussions.microsoft.com> wrote in message
> news:25A3FA53-4E01-40EC-BBC5-9FB25573F8DF@microsoft.com...
> >I would like to garble a const string so that someone cannot search for and
> > change the string in the .exe easily.
> > Is here an easy way to generate the garbled string outside of the IDE to
> > copy into a const string, then ungarble it in the app when I am about to
> > display it?
> > VB6 app
>
>
> Use any kind of encryption. Your constant would be assigned the encrypted
> string. When you need to use it, unencrypt it.
>
> --
> Mike
>
>
Author
17 Mar 2009 10:03 AM
Schmidt
"Lorin" <Lo***@discussions.microsoft.com> schrieb im Newsbeitrag
news:A2341876-4B85-4E43-8196-CCA862BE0809@microsoft.com...

> Which brings up another question.
> Are all the MS encryption APIs on all Windows,
> foreign and domestic?
You could bypass the Win-encryption-APIs, if you
include your own encryption-routines.

There are codesnippets out there e.g. for ArcFour (RC4),
which can give you strong encryption on any VB-
String or ByteArray.
The ArcFour-Routines/Implementations are usually very
small and work fast if you compile to native code.

You can also use them from precompiled Libraries if
you want.
For example the cCrypt-Class which is available in my
toolset contains not only ArcFour, but also SHA1-Hashing,
Diffie-Helman-Public-Key-Algos, Functions for large
Prime-Numbers, different (non-encrypting) Encoding-Algos
(as base64), and different compression-routines as e.g.
ZLib or FastLZ.
All independent of MS-APIs or -libs.

Regarding another thread, where you thought about
usage of DB-based approaches (using SQL for your
queries) instead of Array-based approaches (doing your
own loops), a look at this toolset seems like a good idea,
since it also contains also a complete DB-engine, which
also does not depend on MS-DB-stuff like ADO or JET -
so instead of your Arrays you could use an InMemory-
DB for example.

Though it will add a dependency of 3-Dlls to your App
(ca. 700kB total when UPXed - ca. 2MB when deUPXed,
but usable regfree).

www.datenhaus.de/Downloads/dhRichClient3.zip
www.datenhaus.de/Downloads/dhRichClient3-Demo.zip

Olaf
Author
17 Mar 2009 10:12 AM
Schmidt
"Schmidt" <s**@online.de> schrieb im Newsbeitrag
news:eE289iupJHA.4448@TK2MSFTNGP05.phx.gbl...

> Regarding another thread, where you thought about
> usage of DB-based approaches (using SQL for your
> queries) instead of Array-based approaches (doing your
> own loops), ...
Oops sorry - seems I've mistaken you (the post I had
in mind came from Webbiz).

Olaf
Author
14 Mar 2009 5:52 AM
Larry Serflaten
"Lorin" <Lo***@discussions.microsoft.com> wrote
> I would like to garble a const string so that someone cannot search for and
> change the string in the .exe easily.
> Is here an easy way to generate the garbled string outside of the IDE to
> copy into a const string, then ungarble it in the app when I am about to
> display it?
> VB6 app

Don't don't even need to encrypt it, just don't store it all in one place.
For example make an EXE from the following code and run the program.
Then try to find the message in the EXE...

LFS

Private Sub Form_Load()
  MsgBox Message
End Sub

Private Function Message() As String
Dim itm

  For Each itm In Array("Che", "ck", " thi", "s ou", "t in", " th", "e E", "XE.")
    Message = Message & itm
  Next
End Function
Author
14 Mar 2009 6:13 AM
Larry Serflaten
"Larry Serflaten" <serfla***@usinternet.com> wrote

> > Is here an easy way to generate the garbled string outside of the IDE to
> > copy into a const string, then ungarble it in the app when I am about to
> > display it?
>
> Don't don't even need to encrypt it, just don't store it all in one place.
> For example make an EXE from the following code and run the program.
> Then try to find the message in the EXE...


That was a bad example.  I checked it out using a Hex editor and then
sent it.  Opening it up in Notepad would show the message clear enough
to edit it.  None the less, depending on size, breaking it up between
modules or procedures would do better.  Of course as was suggested,
picking any encryption would most likely make it hard enough for most
purposes....

LFS
Author
14 Mar 2009 2:15 PM
Rick Rothstein
Along those lines, you could hide the password inside a sentence or just
random looking text. Either of these jumbled pieces of text will generate
the same garbled output string (a password for my example). This one...

PW = "May they see sports bad times and assign swears words for your day."

or this one...

PW = "Ms23//3y819z dp32/&$0abs 3lsskji 22sj2!48/wr9(la0os0)om2rma hj1di"

Use this to obtain the real password...

For X = 1 To Len(PW) Step 7
  Password = Password & Mid(PW, X, 1)
Next

Laying out a jumbled string is really quite simple. Decide on the step
amount (I chose to use 7), write your actual text in the Immediate window
and then insert a number of space equal to one less than the step amount you
decided on (6 in this case). So, for my example, I wrote out

M      y      p      a      s      s      w      o      r      d

Then, in the line under it, start writing your garbled text making sure when
you get to one of your letters in the line above it, that you type that
letter. When done, you have your garbled text that contains your actual
text. You can try to make a real or almost real-looking sentence (as I did
in my first PW assignment) for your garbled text, or just garble it up right
from the beginning.

--
Rick (MVP - Excel)


Show quoteHide quote
"Larry Serflaten" <serfla***@usinternet.com> wrote in message
news:ucR4wjGpJHA.5880@TK2MSFTNGP05.phx.gbl...
>
> "Lorin" <Lo***@discussions.microsoft.com> wrote
>> I would like to garble a const string so that someone cannot search for
>> and
>> change the string in the .exe easily.
>> Is here an easy way to generate the garbled string outside of the IDE to
>> copy into a const string, then ungarble it in the app when I am about to
>> display it?
>> VB6 app
>
> Don't don't even need to encrypt it, just don't store it all in one place.
> For example make an EXE from the following code and run the program.
> Then try to find the message in the EXE...
>
> LFS
>
> Private Sub Form_Load()
>  MsgBox Message
> End Sub
>
> Private Function Message() As String
> Dim itm
>
>  For Each itm In Array("Che", "ck", " thi", "s ou", "t in", " th", "e E",
> "XE.")
>    Message = Message & itm
>  Next
> End Function
>
>
Author
14 Mar 2009 4:09 PM
mayayana
In addition to the other suggestions, I've sometimes
used Chr. For instance, a few years ago someone
had psoted a crack for my software based on a hotmail
email address. (I create a key based on the email address.)
Since I don't sell to "webmail" accounts anyway, I added
a foil to the EXE. Since I didn't want the foil to be easily
circumvented I used code something like:

s = "TM"
s1 = "IL"
s = Chr$(72) & Chr$(79) & s & Chr$(65) & s1

That gave me "HOTMAIL" without anything vaguely close
appearing in the file strings.

  (Of course that can't be used as a constant, though.
It'd have to be a variable, since you can't have any
operations in a constant definition.)


Show quoteHide quote
> I would like to garble a const string so that someone cannot search for
and
> change the string in the .exe easily.
> Is here an easy way to generate the garbled string outside of the IDE to
> copy into a const string, then ungarble it in the app when I am about to
> display it?
> VB6 app
>
Author
14 Mar 2009 10:34 PM
Lorin
I am currently thinking I should write an eternal VB6 app to take clear text
and garble it.  Maybe something like what is on Randy Birch's site.
Just a simple NOT AND &HFF per int character is a possiblility.
Or make a byte array and NOT.
Also, could shift left a few bits since usual text printables are in the
0-127 range.
Thoughts?

Show quoteHide quote
"mayayana" wrote:

>   In addition to the other suggestions, I've sometimes
> used Chr. For instance, a few years ago someone
> had psoted a crack for my software based on a hotmail
> email address. (I create a key based on the email address.)
> Since I don't sell to "webmail" accounts anyway, I added
> a foil to the EXE. Since I didn't want the foil to be easily
> circumvented I used code something like:
>
> s = "TM"
> s1 = "IL"
> s = Chr$(72) & Chr$(79) & s & Chr$(65) & s1
>
> That gave me "HOTMAIL" without anything vaguely close
> appearing in the file strings.
>
>   (Of course that can't be used as a constant, though.
> It'd have to be a variable, since you can't have any
> operations in a constant definition.)
>
>
> > I would like to garble a const string so that someone cannot search for
> and
> > change the string in the .exe easily.
> > Is here an easy way to generate the garbled string outside of the IDE to
> > copy into a const string, then ungarble it in the app when I am about to
> > display it?
> > VB6 app
> >
>
>
>
Author
16 Mar 2009 4:47 AM
mayayana
> I am currently thinking I should write an eternal VB6 app to take clear
text
> and garble it.  Maybe something like what is on Randy Birch's site.
> Just a simple NOT AND &HFF per int character is a possiblility.
> Or make a byte array and NOT.
> Also, could shift left a few bits since usual text printables are in the
> 0-127 range.
> Thoughts?

  I expect you know better than anyone else what best suits
your needs. It sounds like the easiest method that won't
produce a telltale string in the executable is all that you need.
Author
16 Mar 2009 10:07 AM
Dave O.
"Lorin" <Lo***@discussions.microsoft.com> wrote in message
news:FC411D5B-B5E3-45D9-ACB7-E3748F493F52@microsoft.com...
>I am currently thinking I should write an eternal VB6 app to take clear
>text
> and garble it.  Maybe something like what is on Randy Birch's site.
> Just a simple NOT AND &HFF per int character is a possiblility.
> Or make a byte array and NOT.
> Also, could shift left a few bits since usual text printables are in the
> 0-127 range.
> Thoughts?

Well here is an incredibly simple routine to jumble up text, it would be
easy to decrypt as long as it's known to be scrambled text, if it's encoded
in an executable the crypt-text is not obvious.

Public Function EasyEncrypt(Plaintext As String) As String
' Painfully simple encryption for comments etc.
' Same routine to encrypt and decrypt
Dim n  As Integer
Dim c  As Integer

EasyEncrypt = StrReverse(Plaintext)
For n = 1 To Len(EasyEncrypt)
  c = Asc(Mid$(EasyEncrypt, n, 1))
  If c > 32 Then
    If c > 127 Then
      c = 383 - c
    Else
      c = 160 - c
    End If
    Mid$(EasyEncrypt, n, 1) = Chr$(c)
  End If
Next
End Function