PDA

View Full Version : about string conts (a lot of then)



arthurprs
31-03-2008, 08:32 PM
sorry for the title, =P
but im not sure about what to write there :lol:

i have a unit with
like 400 strings conts

grouped in const arrays

they are declared like

const
name : array[0..71] of string = (

on the initialization i put all then in a list and do some things later,

so my question is, there is a better way to do that?
i would like to protect these conts from malicious users too :?

waran
31-03-2008, 08:56 PM
Your way is pretty good already; you could load your strings from a file, too.

The only way to save your strings from curious eyes would be some sort
of encryption or at least a camouflage (just be creative).

arthurprs
31-03-2008, 09:09 PM
Your way is pretty good already; you could load your strings from a file, too.

The only way to save your strings from curious eyes would be some sort
of encryption or at least a camouflage (just be creative).

from a encrypted file will be easy, but my app is stand alone, .exe only, so maybe a encrypted file in resource ?

cronodragon
31-03-2008, 09:37 PM
You could create a little program where you introduce the strings, like a ListBox, and executes a encryption algorithm that generates the Pascal const declarations with the encrypted strings, then just copy paste into your code, that would make your work easier. I think it's easy to make one. :) If you need simple encryption code, look here:
http://www.bsdg.org/SWAG/ENCRYPT/index.html

arthurprs
31-03-2008, 09:50 PM
uhm, very interesting cronodragon :)

the problem the major encryptor on this page generate codes like
''3@k3u41#412183\£/

and to convert that in something that delphi recognizes...

arthurprs
31-03-2008, 09:52 PM
maybe base64, its not encryption but the malicious user will not differ it from other binary shit in HEX viewer :?

cronodragon
31-03-2008, 10:00 PM
You could just transform each character of the encryption output to the ASCII representation of it's hexadecimal value :)

arthurprs
31-03-2008, 10:04 PM
You could just transform each character of the encryption output to the ASCII representation of it's hexadecimal value :)
uhm, good option, but what about the base64 (see my lastpost)

cronodragon
31-03-2008, 10:49 PM
You could just transform each character of the encryption output to the ASCII representation of it's hexadecimal value :)
uhm, good option, but what about the base64 (see my lastpost)

I haven't used it, sorry. But if it works for you go ahead :)

arthurprs
01-04-2008, 06:41 PM
i did crafted a simple byte to byte encryption
and a tool that converts a original .pas to another .pas with encrypted strings (ASCII codes) with python (incredible 10 lines),

thanks for the help guys

cronodragon
01-04-2008, 07:04 PM
i did crafted a simple byte to byte encryption
and a tool that converts a original .pas to another .pas with encrypted strings (ASCII codes) with python (incredible 10 lines),

thanks for the help guys

hey, that sounds cool :D