note 37442 added to function.sha1

From: Date: Sat, 15 Nov 2003 08:06:38 +0000
Subject: note 37442 added to function.sha1
Groups: php.notes 
Request: Send a blank email to php-notes+get-60412@lists.php.net to get a copy of this message
Append this to the your sha1lib file to make it more portable. If your version of php does support sha1() then it will try to use Mhash or else it will use the sha1lib. Use $sha1 if you want to display which is being used. if ( function_exists('sha1') ) $sha1 = "sha1"; if ( !function_exists('sha1') && function_exists('mhash')) { function sha1($hash_source) { $hash = mhash(MHASH_SHA1, $hash_source); $hex_hash = bin2hex($hash); return $hex_hash; } $sha1 = "Mhash"; } if ( !function_exists('sha1') && !function_exists('mhash')) { function sha1( $string, $raw_output = false ) { $library = new Sha1Lib(); return $raw_output ? $library->str_sha1($string) : $library->hex_sha1($string); } $sha1 = "sha1lib"; } ---- Manual Page -- http://www.php.net/manual/en/function.sha1.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37442 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37442&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37442&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#60412) next »