Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rancoud/crypt
Crypt Package
https://github.com/rancoud/crypt
argon2i argon2id bcrypt composer coverage crypt cryptography hash packagist php php74 php8 php80 php81 phpunit phpunit9
Last synced: 24 days ago
JSON representation
Crypt Package
- Host: GitHub
- URL: https://github.com/rancoud/crypt
- Owner: rancoud
- License: mit
- Created: 2018-01-27T20:34:34.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-20T10:16:10.000Z (about 2 months ago)
- Last Synced: 2024-10-12T13:20:10.393Z (24 days ago)
- Topics: argon2i, argon2id, bcrypt, composer, coverage, crypt, cryptography, hash, packagist, php, php74, php8, php80, php81, phpunit, phpunit9
- Language: PHP
- Homepage: https://packagist.org/packages/rancoud/crypt
- Size: 401 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# Crypt Package
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/rancoud/crypt)
[![Packagist Version](https://img.shields.io/packagist/v/rancoud/crypt)](https://packagist.org/packages/rancoud/crypt)
[![Packagist Downloads](https://img.shields.io/packagist/dt/rancoud/crypt)](https://packagist.org/packages/rancoud/crypt)
[![Composer dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://github.com/rancoud/Crypt/blob/master/composer.json)
[![Test workflow](https://img.shields.io/github/actions/workflow/status/rancoud/crypt/test.yml?branch=master)](https://github.com/rancoud/crypt/actions/workflows/test.yml)
[![Codecov](https://img.shields.io/codecov/c/github/rancoud/crypt?logo=codecov)](https://codecov.io/gh/rancoud/crypt)Crypt using Argon2id by default with Argon2i and bcrypt in fallback.
## Installation
```php
composer require rancoud/crypt
```## How to use it?
```php
$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