Git Product home page Git Product logo

crypt's Introduction

Crypt Package

Packagist PHP Version Support Packagist Version Packagist Downloads Composer dependencies Test workflow Codecov

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

crypt's People

Contributors

dependabot[bot] avatar rancoud avatar

Watchers

 avatar  avatar  avatar

Forkers

godnite

crypt's Issues

Fix method name

You should change two method names: getCaractersForRandomString, setCaractersForRandomString for getCharactersForRandomString, setCharactersForRandomString so it's fully english names.

I suggest you keep legacy names as alias methods that just call correct name method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.