php-standard-library/hash
Hash utilities for PHP: cryptographic and non-cryptographic hashing via an Algorithm enum, HMAC helpers, and timing-safe string comparison. Lightweight package from PHP Standard Library for consistent, secure hashing across projects.
hash() calls or custom implementations (e.g., password_hash() wrappers) in Laravel apps, standardizing hashing behavior across services.Hash facade (using password_hash()) is already secure, but this package could complement it by offering algorithm-agnostic hashing (e.g., for non-password data) with timing-attack-safe comparisons.composer require php-standard-library/hash and autoload. No Laravel-specific setup required.app('hash')->generate()) or integrated alongside Laravel’s Hash facade for password-specific tasks.Hash facade to avoid duplication. Use this package for non-password hashing (e.g., file checksums, cache keys).Hash facade for password hashing. Mitigate by documenting clear boundaries (e.g., "Use php-standard-library/hash for non-password data").ext-hash or ext-sodium extensions.Hash facade is battle-tested; this package’s long-term maintenance is unclear (0 stars, no active community). Fallback to core PHP functions if needed.Hash facade, or is it for non-password hashing only? Define scope upfront.hash() calls—overhead should be negligible for most use cases.Hash facade (for passwords).SecurityComponent (if using Symfony’s password hashing).composer.json and test in a non-critical module (e.g., generating checksums for logs).hash() calls to validate behavior.md5(), sha1()) with this package.md5(file_get_contents($path)) with HashGenerator::generate('sha256', $bytes).$this->app->singleton('hash', function () {
return new \PhpStandardLibrary\Hash\HashGenerator();
});
Hash facade—keep passwords separate.argon2id, confirm it’s supported).string and resource (file streams) inputs.composer.json and run composer update.config('hash.use_standard_library')) for gradual adoption.hash() if needed.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Algorithm removed in update | Breaks hashing logic | Pin version in composer.json |
| Timing-attack vulnerability | Security risk in comparisons | Use package’s safe comparison methods |
| PHP version incompatibility | Package fails to load | Test on CI with target PHP versions |
| Algorithm collision | False positives in comparisons | Validate against native hash() outputs |
Hash facade.composer why php-standard-library/hash in CI.How can I help you explore Laravel packages today?