Crypt using Argon2id by default with Argon2i and bcrypt in fallback.
composer require rancoud/crypt
$password = 'my_password';
$hash = Crypt::hash($password);
$result = Crypt::verify($password, $hash);
// use only Argon2i
Crypt::useArgon2i();
// use only bcrypt
Crypt::useBcrypt();
- hash(password: string): string
- needsRehash(hash: string): bool
- verify(password: string, hash: string): bool
- getCurrentAlgo(): int
- useArgon2id(): void
- useArgon2i(): void
- useBcrypt(): void
- setOptionArgon2iMemoryCost(bytes: int): void
- setOptionArgon2iThreads(threads: int): void
- setOptionArgon2iTimeCost(time: int): void
- setOptionBcryptCost(rounds: int): void
- getOptionsArgon2i(): array
- getOptionsBcrypt(): array
- getRandomString([length: int = 64], [characters: ?string = null]): string
- getCharactersForRandomString(): string
- setCharactersForRandomString(characters: string): void
composer ci
for php-cs-fixer and phpunit and coverage
composer lint
for php-cs-fixer
composer test
for phpunit and coverage