Tecknik.net: PHP MD5

What is PHP MD5?

PHP MD5 is a PHP implementation of the RSA Data Security, Inc. MD5 Message Digest Algorithm, written as a collection of functions that can be included into any PHP script.

Hashing is something that is available to be built into PHP, but often is not. Most developers (including myself) do not have direct access to the PHP installation they use and, therefore, lack the ability to add the hashing libraries necessary. As PHP MD5 is simply the algorithm written in functions, there's no need to compile any libraries or recompile PHP.

Download PHP MD5

PHP MD5 was derived from a JavaScript implementation by Paul Johnston and, as such, is similarly available for use under the GNU Lesser General Public License:

PHP MD5 1.1

To use PHP MD5, you can either include the PHP file, or directly copy the functions, into your script. You can then call the md5() function whenever you need to, with a string as its argument, which will return the hash as a 40-character hexadecimal number.

For example, md5("Example string.") returns a424ff1aff733bf849ebb93fd0459b78.

Change Log

1.1
There was an error in 1.0 which meant that strings over 55 bytes were producing incorrect hashes. This has been fixed.

See Also

Built with XHTML & CSS

Copyright 2003 Marcus Campbell