List:General Discussion« Previous MessageNext Message »
From:Michael T. Babcock Date:October 31 2002 9:25pm
Subject:Re: [newbie] how do I force a numerical comparison of two md5 strings
View as plain text  
Benjamin Pflugmann wrote:

>So what's left is that you save the real md5 string instead of it's
>hex representation, e.g. in a CHAR BINARY. That's easiest if you have
>the binary representation on the client side. I see no easy way of
>doing it in MySQL if you only have the hex rep (you could split it
>into two strings and use CONV on each of it - but then you could go
>and save them as two BIGINTs to begin with).
>  
>

As Benjamin said later, I'm not sure its worth the performance 
difference, but you basically want for conversion is (pseudo-code 
because I can't be bothered to look up function names in your language 
of preference):

$md5bin = "";
for ($i = 0; $i < len($md5string)/2; $i+=2)
{
    $md5bin += (char)(hex_to_int(mid($md5string, $i, 2))));
}

-- 
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock


Thread
[newbie] how do I force a numerical comparison of two md5 stringsWalter Lee Davis31 Oct
  • Re: [newbie] how do I force a numerical comparison of two md5 stringsBenjamin Pflugmann31 Oct
  • Re: [newbie] how do I force a numerical comparison of two md5 stringsMichael T. Babcock1 Nov