Results 1 to 9 of 9
  1. #1
    Lounger
    Join Date
    Oct 2001
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    password protection (vba )

    I'm protecting Word vba code with password protection. The passwords however can be easily traced by software from lostpassword.com.
    Is there a more sophisticated way for password protection?

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: password protection (vba )

    Use long randomly generated passwords.
    Obfuscate your code by:
    1. Elminating all comments.
    2. Eliminating most white space.
    3. In distributed code, choose meaningless, randomly selected, variable names.
    4. After doing the above, put multiple statementss on a line.

    This will discourage most from even attempting to figure out the code.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: password protection (vba )

    Of course, if you follow Howard's suggestion, you'd better make sure you stash a fully commented, un-obfuscated copy of the code somewhere because it will be just as hard for *you* to untangle when you have to patch it.
    Charlotte

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: password protection (vba )

    You better believe it.

    I have my own code obfuscator.
    Even I cannot undefstand, without a great deal of effort, my own code after obfuscation.

    MSFT does not care about protecting our intellectual property in VS .NET. Note that in VS .NET, code obfuscation is really the only way to protect code as it is not difficult to see other's code. There are already 3rd party code obfuscators available for VS .NET. However, I do not wish to discuss this topic, it's too depressing!

    P.S. I forgot to mention, that not only does code obfuscation make it very expensive for others to steal/read your code, judicious choice of variable names wil usually reduce the size of the code by over 30%. Has a big impact on the size of a Word template for distribution.

  5. #5
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: password protection (vba )

    I've heard that you can protect Word code by building DLLs- but I haven't done this myself. Any thoughts out there?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  6. #6
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: password protection (vba )

    For another slant on this... <img src=/S/wink.gif border=0 alt=wink width=15 height=15>
    http://mindprod.com/unmain.html
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: password protection (vba )

    I have been asked whether I wish to share, or sell, my code obfuscator. The answer is NO.

    For VS .NET, there are already several commercial code obfuscators available and Dan Appleman has a free code obfuscator, for which there is a downloadable e-book available for, as I recall $39.95). I believe that Dan's obfuscator can be found at http://www.abderaware.com/WhitePapers/Obfuscator.htm.

    For VB/VBA, there likely are also code obfuscators, but I never looked into getting them.

    In my case:

    1. I have code that does a pretty good job of building a list of variables, and procedures, using an exception list to not change names that I wish to make Public. My code REQUIRES that one use Option Explicit, i.e., I did not want to have to parse for variable names.

    2. I then generate random names in a mapping table. The name space is always the same, e.g., x, x1, zz, but the mapping is random.

    3. Lastly, I use the brute force approach to replace names. Again, I do not use a parser, so it is possible that non-judicious choices of variable names that are keywords.methods, etc., can get screwed up. However, I rarely make that mistake, so my code works for me. Writing a ful blown parser for VB/VBA might be interesting, but I'd rather spend my time elsewhere.

  8. #8
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Dallas plus 20 miles or so, Texas, USA
    Posts
    876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: password protection (vba )

    Although I am using Excel, I figure that the best objuscater is me, since my code is so obfucated without having an obviscator officially obfuscivate my code, even I cannot figure it out and I have the project password! <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

  9. #9
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: password protection (vba )

    I did this for about three months start of this year, but have retreated to using password-protected DOT files.

    Passwords for 40 templates isn't difficult. Each password is three or more words based on my childhood (who else would know the name of the street that housed the cotton mill on my way to school on the Burnely bus?), and the Passwords.doc that I carry in my shirt pocket doesn't carry the password, it says "name of the street that housed the cotton mill on my way to school on the Burnely bus" rather than "lovecloughclose".


    Oooops!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •