Skip to content

hash(): add xxh3/xxh128 via libxxhash FFI (PHP-in-PHP, #5165) - #8069

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-hash-xxh3-5165
Jun 12, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-hash-xxh3-5165

Conversation

@PurHur

@PurHur PurHur commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Register xxh3 and xxh128 in VmHash::HASH_ALGOS / hash_algos() and route digests through new ext/standard/VmHashXxh.php.
  • Thin libxxhash FFI layer (same pattern as VmZlibNative / VmDns) — 0 new lib/AOT/runtime/*.c lines.
  • php-src reference: ext/hash/hash_xxhash.c (XXH3_64bits, XXH3_128bits).

Verification

docker info >/dev/null
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro-maintainer/hash_xxh3.php
php bin/vm.php test/repro-maintainer/hash_xxh3.php'
# Zend + VM output match (e.g. xxh3("a")=e6c632b61e964e1f)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit --filter VmHashXxhTest
vendor/bin/phpunit --filter hash_xxh3'
# OK (8 tests + 2 compliance VM/JIT)

Closes #5165

Made with Cursor

Wire VmHashXxh through VmHashNative so VM hash() matches Zend digests without new C runtime TUs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit d091778 into master Jun 12, 2026
@PurHur
PurHur deleted the agent/runtime-php-hash-xxh3-5165 branch June 12, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: hash() — xxh3/xxh128 algorithms missing (ext/hash/hash_xxhash.c)

1 participant