Your strings are not safe!!!

Everything else that doesn't fall into one of the other PB categories.
TheBeck
User
User
Posts: 39
Joined: Mon May 12, 2003 6:04 am
Location: the far west
Contact:

Post by TheBeck »

Someone could just use a hex editor and put their own md5 into your exe in place of the original. Just about anything you do can be easily circumvented by a skilled cracker. But we all know this. :(
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: MD5 is ok for casual encryption

Post by PB »

> MD5 [...] is CERTAINLY suitable for turning your strings unrecognizable
> sections of code

Not really... how? All it does is return a signature from text. It cannot
recreate the text from the signature. You need RC4 encryption for that.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

In RC4 does key$ get encoded and decoded as well?
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> In RC4 does key$ get encoded and decoded as well?

RC4 doesn't include the password/key in the encryption. You need to supply
it separately. This means the user can type it in (instead of having the key
stored on disk) and the encrypted string can be recreated from it. See:

Code: Select all

; This example uses Paul's RC4 lib.
Debug CryptString("StringToBeEncrypted",pw$)
Debug DecryptString("AC814A672259E0C12334EE125139D616A964C200",pw$)
In both lines, pw$ = the password that the user supplies, such as from an
InputRequester. The second line is "StringToBeEncrypted" in encrypted
format, which as you can see is different to MD5 encryption which is just
a signature of the string, rather than the string itself.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

MD5 is not defined as encryption, but as a hashing algorithm. It creates a hash of the string you give to it. While it has been cracked, i belive its very secure still, if you use it correctly not letting user just put another md5 in there. So encrypt the hash string or something like that.
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Post by J. Baker »

Thanks PB, now I understand and it works for what I need it for. :D
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Post Reply