md5
(PHP 4, PHP 5, PECL hash:1.1-1.3)
md5 — Calcola il valore md5 di una stringa
Descrizione
string md5
( string $str
[, bool $raw_output
] )
Calcola il valore md5 della stringa str utilizzando il » RSA Data Security, Inc. MD5 Message-Digest Algorithm, e restituisce tale valore. L'hash prodotto è un numero esadecimale di 32 caratteri. Se il secondo parametro raw_output è impostato a TRUE, il valore md5 è restituito nel formato binario raw con una lunghezza di 16 caratteri.
Nota: Il parametro opzionale raw_output è stato aggiunto in PHP 5.0.0, e come default vale FALSE
Example#1 Esempio di uso di md5()
<?php
$str = 'apple';
if (md5($str) === '1f3870be274f6c49b3e31a0c6728957f') {
echo "Would you like a green or red apple?";
exit;
}
?>
Vedere anche crc32(), md5_file() e sha1().