tags:

views:

151

answers:

2

PHP's md5("123123") gives me a correct value of 4297f44b13955235245b2497399d7a93, while mysql's

select md5("123123");

gives me '6e9abeea535938c496a261b3b39c0d79'.

Why would this happen ? does this have anything to do with mysql server incoding? I kinda lost it, help much appreciated!

Thank you!

+1  A: 

I get the same value from mysql and php. Might have something to do with multi-byte characters?


mysql> select md5("123123");
+----------------------------------+
| md5("123123")                    |
+----------------------------------+
| 4297f44b13955235245b2497399d7a93 |
+----------------------------------+
1 row in set (0.00 sec)
  • mysql Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (i486) using readline 6.1

php > echo md5("123123");
4297f44b13955235245b2497399d7a93
  • PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:41:55)

no
+14  A: 

6e9abeea535938c496a261b3b39c0d79 is the value of md5("132123"),so I think you have a type mistake.

SpawnCxy
+1 woah boy, i guess you spotted it bang on :)
Here Be Wolves
<golf clap> Nicely done.
Alex Howansky
+1 You deserve a medal. Unless you just used http://md5crack.com/crackmd5.php , then much less impressive...
Andrew Dunn
I get `04c63186ff836a823b1f7fa0f98f266a` as the md5 of "123123" (with the quotes as part of the string). How can I reproduce what you got?
no
Quotes not part of the string...
Andrew Dunn
`echo -n '"123123"' | md5sum`, `echo md5('"123123"');` (php), and `select md5('"123123"');` (mysql) all give me the value `04c63186ff836a823b1f7fa0f98f266a` ...
no
yeah, nice one indeed :)
Smokie
oh never mind, i see it... 1_3_2123
no