note 72670 added to function.hash

From: Date: Mon, 29 Jan 2007 12:32:27 +0000
Subject: note 72670 added to function.hash
Groups: php.notes 
Request: Send a blank email to php-notes+get-122315@lists.php.net to get a copy of this message
If the hash functions are not available to you at the moment, and you want to future proof your code, then the code below will emulate two of the important hashing functions, they will also be automatically replaced with the faster versions if available. if(!function_exists('hash_algos')) { function hash_algos() { $algo[0] = "md5"; $algo[1] = "sha1"; $algo[2] = "crc32"; return($algo); } } if(!function_exists('hash')) { function hash($algo, $data, $raw_output = 0) { if($algo == 'md5') return(md5($data)); if($algo == 'sha1') return(sha1($data)); if($algo == 'crc32') return(crc32($data)); } } ---- Server IP: 85.116.0.130 Probable Submitter: 82.17.183.142 ---- Manual Page -- http://www.php.net/manual/en/function.hash.php Edit -- https://master.php.net/note/edit/72670 Del: integrated -- https://master.php.net/note/delete/72670/integrated Del: useless -- https://master.php.net/note/delete/72670/useless Del: bad code -- https://master.php.net/note/delete/72670/bad+code Del: spam -- https://master.php.net/note/delete/72670/spam Del: non-english -- https://master.php.net/note/delete/72670/non-english Del: in docs -- https://master.php.net/note/delete/72670/in+docs Del: other reasons-- https://master.php.net/note/delete/72670 Reject -- https://master.php.net/note/reject/72670 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122315) next »