I'm using sha256 on my hash, but when i include google api php client https://code.google.com/p/google-api-php-client/, somehow my hash is changed

so

include 'google-api-php-client.php';
$my_hash = hash('sha256', $my_salted_data);

will produce different result from

$my_hash = hash('sha256', $my_salted_data);

Do you guys know what happened?

有帮助吗?

解决方案

I found what the problem is, After I see Google API PHP Client source code, i found that the script will set default timezone to UTC if not defined in php.ini and my hash algorithm use date function using different timezone, so my hash will produce different result

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top