We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When $raw_output is set to true, hash() outputs vary between implementations.
$raw_output
hash()
$input = random_bytes(10000); $crcG = new Google(CRC32::CASTAGNOLI); $crcG->update($input); $crcP = new PHP(CRC32::CASTAGNOLI); $crcP->update($input); var_dump($crcG->hash(true) === $crcP->hash(true)); // false
I tested all four implementations against an upload to Cloud Storage against PHP 7.2 and PHP 7.3.
Case: Google\CRC32\Builtin SUCCESS Case: Google\CRC32\Google SUCCESS Case: Google\CRC32\PHP FAIL Case: Google\CRC32\PHPSlicedBy4 FAIL
use Google\CRC32\Builtin; use Google\CRC32\CRC32; use Google\CRC32\Google; use Google\CRC32\PHP; use Google\CRC32\PHPSlicedBy4; $content = random_bytes(1000); $classes = [ Builtin::class, Google::class, PHP::class, PHPSlicedBy4::class ]; foreach ($classes as $class) { $crc = new $class(CRC32::CASTAGNOLI); $crc->update($content); print('Case: ' . $class . PHP_EOL); try { $bucket->upload($content, [ 'name' => uniqid(), 'metadata' => [ 'crc32c' => base64_encode($crc->hash(true)) ] ]); print('SUCCESS' . PHP_EOL); } catch (\Exception $e) { print('FAIL' . PHP_EOL); } print('' . PHP_EOL); }
The text was updated successfully, but these errors were encountered:
3edf450
No branches or pull requests
When
$raw_output
is set to true,hash()
outputs vary between implementations.I tested all four implementations against an upload to Cloud Storage against PHP 7.2 and PHP 7.3.
The text was updated successfully, but these errors were encountered: