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?

Was it helpful?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top