About Store Forum Documentation Contact



Post Reply 
MD5 how?
Author Message
Hexer Offline
Member

Post: #1
MD5 how?
Hi!

How use Md5 in Esenthel?

Can you some sample code?
06-28-2013 01:24 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #2
RE: MD5 how?
Are you referring to the hash function?
06-28-2013 04:39 PM
Find all posts by this user Quote this message in a reply
Hexer Offline
Member

Post: #3
RE: MD5 how?
(06-28-2013 04:39 PM)Pixel Perfect Wrote:  Are you referring to the hash function?

Yes
06-28-2013 04:56 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #4
RE: MD5 how?
I have no idea off the top of my head what the algorithm is. If I were you I'd Google it and see if you can't find some C++ source code for it.
06-28-2013 07:02 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #5
RE: MD5 how?
You could try something like:

UID _uid = MD5Mem( &ObjectToHash, SIZE( ObjectToHash ) );

Is that what you were looking for?
06-28-2013 08:44 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #6
RE: MD5 how?
Ah .. so that's how he generates his UIDs smile
06-28-2013 09:51 PM
Find all posts by this user Quote this message in a reply
Hexer Offline
Member

Post: #7
RE: MD5 how?
UID id_hash, id_pass;;

Str pass="123";
Str hash_pass="202cb962ac59075b964b07152d234b70";

id_pass.fromText(hash_pass);
id_hash=MD5Mem(&pass, SIZE(pass));

D.text(0, -0.1, S+"Result: "+Compare(id_pass, id_hash));

Why they are not equal?
06-28-2013 11:27 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #8
RE: MD5 how?
You got me there. Esenthel will have to answer this one.
06-29-2013 03:04 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: MD5 how?
you are calculating hash of the Str C++ object, and not the string itself, you should do:

// wide char
Str s;
MD5Mem(s(), s.length()*SIZE(*s()));

or

// 1-byte char
Str8 s8=s;
MD5Mem(s8(), s8.length()*SIZE(*s8()));
06-29-2013 10:21 AM
Find all posts by this user Quote this message in a reply
Post Reply