bordoni/phpass
Modernized, namespaced fork of Openwall Phpass (0.3) with Composer autoloading and unit tests. Provides PasswordHash for hashing and verifying passwords with minimal stylistic changes; public domain code, PHP 5 style.
hautelook/phpass or legacy systems). Misaligned for new projects where Laravel’s native Hash facade (using paragonie/bcrypt) is preferred.Hash facade; requires manual integration. Shadows Laravel’s Hash service if both are loaded.$2a$...).paragonie/bcrypt or Laravel’s Hash in the same project.varchar(255) for password column). Existing Laravel apps using Hash may need hash migration.HashPassword, CheckPassword) but no Laravel service provider integration by default.Hash facade (cannot verify Phpass hashes with Hash::check).Hash; cost factor tuning may be required for production load.Hash?
Hash facade (or paragonie/bcrypt) achieve the same goals with lower risk?Hash) if Phpass breaks?Hash facade (hash format mismatch).paragonie/bcrypt (duplicate bcrypt implementations).// app/Providers/AppServiceProvider.php
$this->app->singleton(PasswordHash::class, function () {
return new \Hautelook\Phpass\PasswordHash(config('hash.cost'), false);
});
config/app.php under aliases (optional):
'Phpass' => \Hautelook\Phpass\PasswordHash::class,
Phase 1: Dependency Addition
composer.json:
"require": {
"bordoni/phpass": "^0.3.6"
}
composer update bordoni/phpass --with-dependencies.Phase 2: Authentication Flow Updates
// Old (Laravel Hash)
$hash = Hash::make($request->password);
// New (Phpass)
$hasher = app(PasswordHash::class);
$hash = $hasher->HashPassword($request->password);
// Old
if (Hash::check($request->password, $user->password)) { ... }
// New
$hasher = app(PasswordHash::class);
if ($hasher->CheckPassword($request->password, $user->password)) { ... }
Phase 3: Database Schema Validation
password column in users table:
varchar(255) (Phpass hashes are ~60 chars).$2a$08$....Schema::table('users', function (Blueprint $table) {
$table->string('password')->nullable()->change();
});
Phase 4: Hash Backfill (If Migrating)
$users = User::all();
$hasher = app(PasswordHash::class);
foreach ($users as $user) {
$user->password = $hasher->HashPassword($user->password); // Plaintext risk! Avoid.
$user->save();
}
Phase 5: Deprecate Laravel’s Hash (Optional)
Hash facade from config/app.php if fully transitioning to Phpass.intval deprecation (PR #5), but untested on 8.2+.Hash service provider.$2a$08$... (Phpass-specific).Hash::check.true in PasswordHash(8, true) for compatibility, but avoid unless necessary (reduces security).config('auth.use_phpass')) for gradual migration.Hash facade only after full validation.Hash if Phpass becomes unsustainable.^0.3.6 to avoid breaking changes).How can I help you explore Laravel packages today?