Results 1 to 7 of 7

Thread: Would you hardcode a Rot13 string in a DLL?

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Would you hardcode a Rot13 string in a DLL?

    What do you think, if you were doing Rot13, would you do something like this:

    Code:
      string abFrom = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
                string abTo = "NOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLM";
    Or would you generate the respective strings as shown, for example, on this page? http://www.osix.net/modules/article/?id=70

    The merits and demerits of Rot13 are not being discussed here, it's just a matter of... if it's an encoding-decoding mechanism as simple as Rot13, would you simply hardcode it or generate it?

  2. #2

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Would you hardcode a Rot13 string in a DLL?

    Oh and if you have some links about the merits vs demerits of hardcoding such strings in a DLL, that'd be great. This does seem like somewhat vaguely murky water and it's as though doing either thing really doesn't matter.

  3. #3
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Would you hardcode a Rot13 string in a DLL?

    For something like Rot13, I think it would be a good idea to hard code them as it future proofs whatever is encoded/decoded with your methods. if you dynamically generated them and somehow a new letter is added to our alphabet. Your code still works but none of the encrypted data can be decrypted.

    Though I don't think I would hard code it via an actual string inside of a class. I would prefer to put them into some sort of configuration file.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Would you hardcode a Rot13 string in a DLL?

    I was kind of hoping I could figure this out (without having to ask) by the responses to the questions, but such is not the case, so I'm going to ask.

    What is a Rot13 string?

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Would you hardcode a Rot13 string in a DLL?

    ROTate the string 13 characters.... So A becomes A + 13, or N.....

    I wouldn't hard code them.... especially as constants.... any one with a decent Notepad could open the file and see the strings, and figure out the Rot13....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Would you hardcode a Rot13 string in a DLL?

    Quote Originally Posted by Hack
    What is a Rot13 string?
    http://en.wikipedia.org/wiki/ROT13
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  7. #7
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Would you hardcode a Rot13 string in a DLL?

    I wouldn't hard code it because you can see it with notepad - but if I had to hard code it I would do so as a single interleaved string for faster lookups.

    Code:
    string abAll = "ANBMCODPEQFRGSHTIUJV....

Posting Permissions

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



Click Here to Expand Forum to Full Width