Skip to content

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

Closed

Description

@PurHur

Category

stdlib

Problem

hash('xxh3', $data) returns false (unknown algorithm) instead of the hex digest Zend produces. PHP 8.1+ registers xxh3 and xxh128 via ext/hash; this is distinct from #4644 (crc32/adler32/fnv family).

php-src reference

Repro (failure today)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro-maintainer/hash_xxh3.php
php test/repro-maintainer/hash_xxh3.php
'
Runtime hash('xxh3', 'a')
Zend PHP 8.2 'e6c632b61e964e1f'
bin/vm.php false

Scope (this repo)

Done when

hash('xxh3', …) and hash('xxh128', …) match Zend digests for sample inputs; invalid algo still follows #4186 ValueError semantics.

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 3, 2026
  2. PurHur commented on Jun 12, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — starting this run (xxh3/xxh128 hash algorithms in ext/standard, no new C runtime).

  3. added a commit that references this issue on Jun 12, 2026
    d091778
  4. PurHur commented on Jun 12, 2026

    @PurHur
    OwnerAuthor

    Merged via #8069

    PHP path: ext/standard/VmHashXxh.php (libxxhash FFI, no new C runtime TUs).

    Verification:

    ./script/docker-exec.sh -- bash -lc 'php test/repro-maintainer/hash_xxh3.php && php bin/vm.php test/repro-maintainer/hash_xxh3.php'
    ./script/docker-exec.sh -- bash -lc 'vendor/bin/phpunit --filter VmHashXxhTest && vendor/bin/phpunit --filter hash_xxh3'

    Zend + VM digests match (e.g. hash('xxh3','a')=e6c632b61e964e1f).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions