Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top