|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-03-31 20:41 UTC] dragos at codersnest dot com
[2006-04-01 19:57 UTC] tony2001@php.net
[2006-04-09 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 20:00:01 2025 UTC |
Description: ------------ I tried to do a gateway script which required me to send a hash(SHA1) of some given data, with a given key. In the beginning it worked, then after we switched to production, the key changed length from 32 to 194 (hex chars). The key was calculated as pack() binary value from the original key. At this point, the value returned by mhash() got wrong. So, basically, I am assuming that there is somewhere a constraint on the key length, either on pack() there might be a problem, though i've used that one before. Reproduce code: --------------- example 1 (working): $data = 'some string data'; $mkey = '00112233445566778899AABBCCDDEEFF'; $mac = bin2hex(mhash(MHASH_SHA1,$mac,pack('h*',$mkey))); This was working! example 2: $mkey='496E7465726E6574206765626F72656E2C20656E747769636B656C7420756E6420756D67657365747A742E20656E7465727061796D656E74206661737374206469652067846E6769677374656E205A61686C617274656E20696E2065696E656D20'; This was not workign anymore! Expected result: ---------------- a correct hash value which to be checked at the gateway again by calculating the same hash from fields of a form.. Actual result: -------------- bad hash value