rancoud / crypt
Crypt package
Installs: 7 173
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=7.4.0
- ext-mbstring: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16 || ^3.0
- phpunit/phpunit: ^9.1 || ^10.0 || ^11.0
- squizlabs/php_codesniffer: ^3.5
- dev-master
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.10
- 3.2.9
- 3.2.8
- 3.2.7
- 3.2.6
- 3.2.5
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.0
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-dependabot/composer/friendsofphp/php-cs-fixer-3.68.0
- dev-dependabot/composer/friendsofphp/php-cs-fixer-3.67.1
This package is auto-updated.
Last update: 2025-01-14 11:54:53 UTC
README
Crypt using Argon2id by default with Argon2i and bcrypt in fallback.
Installation
composer require rancoud/crypt
How to use it?
$password = 'my_password'; $hash = Crypt::hash($password); $result = Crypt::verify($password, $hash); // use only Argon2i Crypt::useArgon2i(); // use only bcrypt Crypt::useBcrypt();
Crypt
Static Methods
Main functions
- hash(password: string): string
- needsRehash(hash: string): bool
- verify(password: string, hash: string): bool
Algos
- getCurrentAlgo(): int
- useArgon2id(): void
- useArgon2i(): void
- useBcrypt(): void
Options
- setOptionArgon2iMemoryCost(bytes: int): void
- setOptionArgon2iThreads(threads: int): void
- setOptionArgon2iTimeCost(time: int): void
- setOptionBcryptCost(rounds: int): void
- getOptionsArgon2i(): array
- getOptionsBcrypt(): array
Random string
- getRandomString([length: int = 64], [characters: ?string = null]): string
- getCharactersForRandomString(): string
- setCharactersForRandomString(characters: string): void
How to Dev
composer ci
for php-cs-fixer and phpunit and coverage
composer lint
for php-cs-fixer
composer test
for phpunit and coverage