PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




md5

Name

md5 — Generates the MD5 hash of a string.

Synopsis

string md5(string);
string string: String for which to generate an MD5 hash

Returns

32-character string

Description

md5() generates and returns the MD5 hash for the provided string.

The MD5 algorithm "[...takes as input a message of arbitrary length and produces as output a 128-bit 'fingerprint' or 'message digest' of the input. It is conjectured that it is computationally infeasible to produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The MD5 algorithm is intended for digital signature applications, where a large file must be 'compressed' in a secure manner before being encrypted with a private (secret) key under a public-key cryptosystem such as RSA." RFC 1321: The MD5 Message-Digest Algorithm]

Version

PHP 3+, PHP 4+

See also

To generate hashes using other algorithms:

The mhash functions

crc32()



Example

Example 1207. Generate an MD5 hash

<?php
$string = 'Porcupine Pie; Vanilla Soup';

echo "Original String  : $string",
     "MD5 hash of string: ", md5($string);
?>

Output:
Original String   : Porcupine Pie; Vanilla Soup
MD5 hash of string: 12fdf01d82fb55b609fefe2192ec58c5



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.