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 Laravel Package

php-standard-library/hash

Cryptographic and non-cryptographic hashing for PHP with an Algorithm enum, timing-safe comparison, and HMAC support.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • The package is framework-agnostic and sits beside Laravel's Hash facade rather than replacing it. Laravel's Hash is password-oriented (bcrypt/argon2 via password_hash()); this package covers the other 80% of hashing work that teams improvise — cache keys, ETags, file checksums, dedupe keys, webhook signatures, HMAC tokens.
  • The real product value is governance, not capability: a typed Algorithm enum, one HMAC entry point, and one timing-safe comparator. Everything under it is a thin wrapper over ext-hash (hash(), hash_hmac(), hash_equals()), which Laravel already exposes natively. A TPM should frame the business case as "eliminate ad-hoc hashing variants across the codebase and audit logs," not "add hashing we don't have."
  • The Algorithm enum is the strongest architectural hook: it makes algorithm choice a code-reviewable artifact and a candidate for static-analysis rules (ban bare md5()/sha1()), which is how the standard actually gets enforced.

Integration feasibility

  • Trivially installable via Composer; no framework coupling, no service provider required, no config publishing. Expected integration cost is in the inventory and migration of existing call sites, not in the wiring.
  • Caution on the container binding: do not register this under the hash key. Laravel already binds hash to Illuminate\Hashing\HashManager; overwriting it silently breaks password hashing and anything resolving Hash from the container. Use a distinct key (hash.standard, HashGenerator::class) and a distinct facade alias.
  • Byte-for-byte output parity with native functions is the acceptance test that makes migration safe; if parity can't be asserted for an algorithm, that algorithm doesn't get used.

Technical risk

  • Adoption signal is the dominant risk. 0 stars and 0 dependents on a package whose entire job is cryptographic correctness means: no independent security review, no community CVE surface, no third-party production evidence. The overall score of 21.7 reflects this correctly. A TPM cannot treat this as a vetted dependency without an internal review of the timing-safe comparison implementation and the HMAC construction (hash_hmac with $raw_output/binary key handling).
  • Maturity metadata is thin and partly unreliable: the listed last release date (2026-10-28) is forward-dated relative to any realistic review window, and every release note body is a redirect to the monorepo. That means changelog and issue visibility live upstream, and the split repo tells you nothing. Verify tags against the main repository before pinning.
  • Algorithm availability is host-dependent, not package-dependent. Which Algorithm cases actually resolve depends on hash_algos() on the runtime image (xxHash family, blake3-class algorithms vary by PHP build). Enum ergonomics can create an illusion of portability across services that does not exist.
  • Scope creep into passwords is the failure mode most likely to reach production: a "standard hashing library" will be reached for by developers implementing auth. Password hashing must stay on Laravel's Hash/password_hash() path, permanently.

Key questions

  1. Does the timing-safe comparator match hash_equals() semantics exactly, including unequal-length input handling? Any length-dependent early exit is a vulnerability, not a style issue.
  2. Who on the team owns reviewing the source before it enters the dependency tree, and what's the review checklist?
  3. Which algorithms do we actually need, and are all of them present in our production PHP build (hash_algos())?
  4. Do any downstream consumers (other services, mobile, third-party partners) depend on hash values we produce today? Output drift there is a data-integrity incident, not a refactor.
  5. Is the fork-and-vendor plan acceptable if upstream goes dormant — and does anyone own patching a forked crypto wrapper?
  6. What does this buy over a 40-line internal Hasher class with a backed enum? If the answer is "a maintained implementation," that claim needs evidence this package can't currently supply.

Integration Approach

Stack fit

  • Laravel 10/11/12 on PHP 8.1+; no conflicts with ext-hash, ext-sodium, or Laravel's Hash manager. Compatible with Octane and long-running workers (stateless, no mutable global configuration surface described).
  • Correct layering: Laravel Hash → passwords and anything password_verify-shaped. This package → everything else (checksums, cache keys, HMAC signatures, token comparison, PII tokenization for logs).
  • For polyglot estates, the enum becomes the shared contract: consumers in Node/Go must pin the algorithm and encoding, not the library. That spec, not the package, is the durable artifact.

Migration path

  1. Inventory — grep for md5(, sha1(, crc32(, hash(, hash_hmac(, ==/=== on tokens, and hand-rolled comparison loops. Produce a call-site table with data classification (does a stored value depend on the output?).
  2. Pilot — one low-blast-radius module, ideally a new feature (cache key derivation or ETag generation) with no persisted values. Proves ergonomics and parity at zero risk.
  3. Replace leaf call sites — sites where output is transient or recomputed (cache keys, request signatures, dedupe keys). These can be swapped without backfill.
  4. Replace persisted-output sites last — requires dual-write, backfill, or versioned key prefixes; treat as a mini-migration with a rollback plan.
  5. Enforce — PHPStan/Psalm rule or CI grep that fails builds on raw md5()/sha1() and on non-constant-time token comparison. This is where the standard actually sticks; without it, the package is optional decoration.

Compatibility

  • Verify each required Algorithm case resolves on every runtime image (local, CI, staging, prod containers) — not just on a developer machine.
  • Contract tests asserting PackageOutput === native_function_output per algorithm, including binary input, empty string, and multi-megabyte payloads.
  • Cross-service conformance: if a Node service validates signatures this package generates, pin encoding (hex vs base64 vs raw) and key derivation in a written spec and test it in both languages.

Sequencing

  • Gate 0: internal source review of the comparator and HMAC paths + supply-chain check (packagist ownership, tag provenance). Stop here if it fails — a small internal wrapper over native functions is a legitimate outcome.
  • Gate 1: pilot merged behind a config flag, parity tests green in CI.
  • Gate 2: static-analysis rule active in warn mode; team guidance doc published (passwords vs. everything else).
  • Gate 3: enforcement mode; pinned exact version in composer.json with the lockfile committed and the package recorded in the SBOM.

Operational Impact

Maintenance

  • Low code-level maintenance burden (thin wrapper, MIT, no runtime services), but non-trivial ownership burden: someone must track upstream tags in the monorepo, since this repo's releases only redirect. Calendar a quarterly review.
  • Pin exact versions. This is the wrong dependency to float on ^6. Budget for fork-and-vendor: at this adoption level, assume the fork is the contingency and pre-verify that the source is small enough to carry (it should be).
  • PHP minor-version upgrades are the realistic trigger for maintenance work — algorithm availability and deprecations shift with ext-hash.

Support

  • Zero dependents means zero community answers; there is no Stack Overflow path to a fix. Every question routes to the internal owner.
  • Internal support surface is small and trainable: three concepts (Algorithm, generate, compare/verify). The support cost is concentrated in policy questions ("which algorithm here?") rather than bug triage.
  • Escalation must land somewhere concrete. Name an owner and a fallback: swap to native hash()/hash_equals() behind the same internal interface, which is why an internal interface is worth having even if it just delegates to this package.

Scaling

  • Runtime overhead is negligible — it delegates to the same C functions. Do not budget for a performance workstream, but do benchmark if you're hashing in a hot loop (bulk file dedupe, per-request large payloads) to confirm the wrapper doesn't force extra copies of large strings.
  • Horizontal scaling is unaffected: stateless, no shared state, no configuration drift.
  • The scaling risk is organizational, not technical: a shared hashing standard is easy to adopt in one service and hard to keep consistent across ten. The spec document scales; the package alone doesn't.

Failure modes

Failure Blast radius Detection Mitigation
Output drift after upgrade/algorithm change High — invalidates stored checksums, cache keys, signatures; auth failures or silent cache misses Parity contract tests in CI; signature conformance tests Version pin; never change algorithm in place — version the key/prefix
Timing-safe comparator misused (=== instead of the comparator) High — side-channel exposure Static analysis rule; targeted security test Enforce via CI lint, not docs
Wrong algorithm selected (MD5 in a security-relevant path) Medium–High Code review against the enum decision table Publish an approved-algorithm matrix; default to SHA-256
Algorithm unavailable on host Medium — runtime exception in prod only Container smoke test enumerating required cases Assert hash_algos() coverage at boot/deploy
Upstream abandonment or compromised release Medium (High if unvetted) Packagist monitoring; pinned tags Fork, vendor, internal review gate before any version bump
Overwriting Laravel's hash container binding High — breaks password hashing app-wide Integration test on auth flows Distinct binding key and facade alias

Ramp-up

  • API surface is small enough for a competent Laravel engineer to be productive in under a day; the pilot should be scoped to ~1 sprint including inventory, parity tests, and the guidance doc.
  • The real ramp-up cost is the decision framework, not the API: when to use this vs. Laravel Hash vs. hash_equals directly. That's a one-page doc plus one review cycle, and it is the single highest-leverage artifact in the whole adoption.
  • Recommend an explicit "no" list alongside the "yes" list — passwords, anything needing algorithms absent from hash_algos(), quantum-resistant requirements — so the boundary is decided once rather than per pull request.
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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator