Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Hash Compat Laravel Package

indigophp/hash-compat

Provides a hash_equals() polyfill for PHP versions older than 5.6, where the native timing-attack-safe string comparison function isn't available. A small compatibility shim for legacy projects.

Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • This is a function-level polyfill, not a framework component: no service provider, no config, no facades, no container bindings. It occupies zero architectural surface and is loaded as a Composer files autoload shim.
  • It targets PHP < 5.6 (and < 5.5 for hash_pbkdf2), so its fit is entirely a function of one question: does the estate still contain PHP 5.3–5.5 runtimes? If not, it is dead weight.
  • Its only legitimate use is as a stopgap in a legacy Laravel 4.x/early 5.x application that is blocked from a PHP upgrade and needs timing-safe comparison (hash_equals) or PBKDF2.

Integration feasibility

  • Trivially installable via Composer and safe in principle because polyfills guard declarations with function_exists. In practice, the package is unmaintained and the repository is not resolvable from the metadata, so there is no visible source, CI, or commit history to review before adopting.
  • Any polyfill that declares global functions is order-sensitive: if another polyfill (e.g., Symfony's) declares the same functions first, behavior depends on autoload ordering and can produce fatal redeclaration errors — a class of bug that surfaces late and inconsistently across environments.

Technical risk

  • Abandoned and archived: last release 2015-08-22, no maintainer, no security response path. It will not appear in normal advisory feeds, and no fix will ever ship.
  • Cryptographic code: hash_equals and hash_pbkdf2 implementations must be constant-time and spec-correct. A naive PHP implementation can introduce a timing side-channel while appearing to fix one — the worst possible outcome for a security-motivated dependency.
  • Supply chain: unresolvable repository plus 25 stars means no community scrutiny. Vendoring unverified crypto code is a governance finding, not an engineering convenience.
  • Target platform is EOL: PHP 5.x has received no security patches since 2018/2019; this package only exists to extend the life of an unsupported runtime.

Key questions

  1. Which services, if any, still run PHP < 5.6, and what is the documented upgrade blocker?
  2. Exactly which functions are missing — hash_equals only, or hash_pbkdf2 as well? The answer may narrow the solution to a maintained polyfill.
  3. Why not Symfony's polyfill-php56 (maintained, widely audited) or paragonie/random_compat instead of an archived single-purpose package?
  4. Can we obtain and review the source before adoption, or is the artifact only available as a pinned Composer download?
  5. Who owns this dependency, and what is the removal date?

Integration Approach

Stack fit

  • Compatible only with Composer-based PHP 5.3–5.5 applications; framework-agnostic, so it drops into Laravel 4.2 or Laravel 5.0–5.1 without modification.
  • Does not belong in any PHP 7+/8+ service, and shipping it there is a net negative (unused code, audit noise, redeclaration risk during future upgrades).

Migration path

  • Preferred: upgrade the runtime. On PHP 5.6+, hash_equals is native and this dependency is deleted outright — zero code change.
  • If the upgrade is genuinely blocked, substitute a maintained polyfill (symfony/polyfill-php56) rather than this package; it covers the same gap with an active security process.
  • Last resort: fork the package into an internal namespace, pin to a specific commit, and treat the fork as first-party code subject to our review and patching.

Compatibility

  • Confirm in a staging build whether the functions are declared globally or namespaced, and audit the full dependency tree for other polyfills declaring hash_equals/hash_pbkdf2. Resolve by loading this one first or removing the duplicate.
  • Verify behavior against native PHP 5.6 for edge cases: non-string arguments, multibyte input, empty strings, and algorithm availability.

Sequencing

  1. Inventory PHP versions and locate every runtime below 5.6.
  2. Determine the precise function gap per application.
  3. Decide: upgrade runtime (default) → maintained polyfill → internal fork of this package.
  4. If adopted, pin the exact version, vendor the source, and add a regression test asserting constant-time behavior and output parity with native.
  5. Register a removal ticket tied to the PHP upgrade so the dependency cannot quietly persist.

Operational Impact

Maintenance

  • Effectively zero upstream maintenance. Ownership transfers to us on day one: dependency review, source archival, and any future patching are internal costs.
  • No release cadence, no changelog, no issue triage — the dependency will never improve and never regress, which is only acceptable if it is genuinely frozen and isolated.

Support

  • No vendor or maintainer to escalate to. Incident response for a crypto bug in this shim is entirely our own, with no upstream disclosure channel.
  • Standard SCA tooling will likely flag it as abandoned; expect recurring exceptions in security reviews unless the dependency is scoped and time-boxed in policy.

Scaling

  • Pure-PHP PBKDF2 is materially slower than the native C implementation — for password hashing at realistic iteration counts this can be an order-of-magnitude difference on the authentication hot path.
  • That slowdown is a direct denial-of-service lever: login and token-derivation endpoints become CPU-bound under modest load. Benchmark before rollout and cap iteration counts; do not assume parity with native.
  • hash_equals cost is negligible at any realistic volume.

Failure modes

  • Fatal error from function redeclaration after a PHP upgrade or a new polyfill entering the tree — typically caught only at boot in production if staging runs a different PHP version.
  • Silent timing leak if the constant-time comparison implementation is imperfect; no test will fail, but the security property does not hold.
  • Behavioral divergence from native implementations on edge-case inputs, producing inconsistent auth results between upgraded and non-upgraded nodes during a rolling migration.
  • Cryptographic drift: if the shim ever becomes load-bearing for password verification, escaping it later requires rehash-on-login handling for every stored credential.

Ramp-up

  • Engineering effort to adopt is near zero — install, boot, verify. The real cost is governance: a source review of unverifiable crypto code and a security exception.
  • The correct framing for the team is not "add a dependency" but "accept ownership of an unmaintained cryptographic shim to defer a PHP upgrade." That trade should be made explicitly, with an expiry date, and only where the alternative is worse.

TPM recommendation: do not adopt as a new dependency. Its score, archive status, and unresolvable source are disqualifying for cryptographic code. Where the function gap is real and the PHP upgrade is blocked, use a maintained polyfill; where it is not, delete the requirement and spend the effort on the runtime upgrade.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource