note 33872 added to function.mhash

From: Date: Wed, 09 Jul 2003 22:02:20 +0000
Subject: note 33872 added to function.mhash
Groups: php.notes 
Request: Send a blank email to php-notes+get-51806@lists.php.net to get a copy of this message
Don't forget php has two built in hashing algorithms: md5(), and sha1() So if you are using: mhash(MHASH_MD5, $str) or mhash(MHASH_SHA1, $str) you could use md5($str) or sha1($str). ** But remember that md5() and sha1() produce HEX output while mhash() produces a BIN output. So: md5($str) == bin2hex(mhash(MHASH_MD5, $str)) sha1($str) == bin2hex(mhash(MHASH_SHA1, $str)) AND pack("H*", md5($str)) == mhash(MHASH_MD5, $str) pack("H*", sha1($str)) == mhash(MHASH_SHA1, $str) (Just remember to pack() or bin2hex() your output to get the output you need) -Lance ---- Manual Page -- http://www.php.net/manual/en/function.mhash.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33872 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33872&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33872&report=yes

« previous php.notes (#51806) next »