Question

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?

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top