note 74185 deleted from function.md5 by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 Jul 2011 13:58:23 +0000 |
| Subject: | note 74185 deleted from function.md5 by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181642@lists.php.net to get a copy of this message | ||
Note Submitter: public at kreinacke dot com
----
PHP's md5() function returns the exact same hash value as MySQL's MD5() function and other
than stated before as the md5sum command line tool on most Linux/UNIX systems.
Note that trailing line feeds do matter, when you apply md5sum on a text file:
shell> php -r 'echo md5("test");'
--> 098f6bcd4621d373cade4e832627b4f6
mysql> select md5('test');
--> 098f6bcd4621d373cade4e832627b4f6
shell> echo -n test | md5sum
--> 098f6bcd4621d373cade4e832627b4f6
In the third example, note the '-n' option, which prevents echo from appending a line
feed.