{"id":21216881,"url":"https://github.com/lablnet/php-hashing","last_synced_at":"2025-07-10T11:32:59.549Z","repository":{"id":57010514,"uuid":"169372855","full_name":"lablnet/PHP-Hashing","owner":"lablnet","description":"This Package  provides secure Bcrypt and Argon2 hashing for storing user passwords.","archived":false,"fork":false,"pushed_at":"2019-02-06T08:18:20.000Z","size":8,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-25T02:03:39.935Z","etag":null,"topics":["argon2","bcrypt","classes","free","hashing","oop","package","passwords-hash","php","secured"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lablnet.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-06T08:06:08.000Z","updated_at":"2021-04-18T10:38:47.000Z","dependencies_parsed_at":"2022-08-21T13:10:11.652Z","dependency_job_id":null,"html_url":"https://github.com/lablnet/PHP-Hashing","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lablnet/PHP-Hashing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Hashing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Hashing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Hashing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Hashing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lablnet","download_url":"https://codeload.github.com/lablnet/PHP-Hashing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lablnet%2FPHP-Hashing/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264573272,"owners_count":23630453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argon2","bcrypt","classes","free","hashing","oop","package","passwords-hash","php","secured"],"created_at":"2024-11-20T21:56:07.965Z","updated_at":"2025-07-10T11:32:59.297Z","avatar_url":"https://github.com/lablnet.png","language":"PHP","readme":"\n\n# PHP Hashing\nThis Package  provides secure Bcrypt and Argon2 hashing for storing user passwords.\n\n## Requirement\n1. PHP 7 (7.3 Recommanded).\n2. Composer.\n\n\u003e The Argon2i driver requires PHP 7.2.0 or greater and the Argon2id\n\u003e driver requires PHP 7.3.0 or greater.\n\n\u003e Bcrypt is a great choice for hashing passwords because its \"work factor\" is adjustable, which means that the time it takes to generate a hash can be increased as hardware power increases.\n\n## Insallation\nInstalling this package is very simple, first ensure you have the right PHP version and composer installed then in your terminal/(command prompt) run:\n``` composer require lablnet/hashing ```\n\n## Basic Usage\nYou may hash a password by calling the `make` method on the Hashing Class:\n\n```php\n\u003c?php \nuse Lablnet\\Hashing;\nrequire '../vendor/autoload.php';\n\n$hashing = new Hashing();\n\n//Original password\n$password = 123456;\n//Hash the password\n$password_hash = $hashing-\u003emake($password);\necho $password_hash;\n```\n### Adjusting The Bcrypt Work Factor\nIf you are using the Bcrypt algorithm, the `make` method allows you to manage the work factor of the algorithm using the  cost option:\n\n```php\n$hashing = new Hashing('bcrypt');\n$password_hash = $hashing-\u003emake($password, [\n    'cost' =\u003e 12\n]);\n```\n### Adjusting The Argon2 Work Factor\nIf you are using the Argon2I or Argon2Id algorithm, the `make` method allows you to manage the work factor of the algorithm using the  memory, time, and threads options:\n\n```php\n$hashing = new Hashing('argon2i');\n$password_hash = $hashing-\u003emake($password, [\n    'memory' =\u003e 1024,\n    'time' =\u003e 2,\n    'threads' =\u003e 2,\n]);\n```\n\n\u003e For more information on these options, check out the  [official PHP documentation](https://secure.php.net/manual/en/function.password-hash.php).\n\u003e \n### Verifying A Password Against A Hash\nThe `verify` method allows you to verify that a given plain-text string corresponds to a given hash\n```php\nif ($hashing-\u003everify($password,$password_hash)) {\n\t//The password matched.\n}\n```\n\n### Checking If A Password Needs To Be Rehashed\nThe `needsRehash` function allows you to determine if the work factor used by the hashing has changed since the password was hashed:\n\n```php\nif ($hashing-\u003eneedsRehash($hashed)) {\n    $password_hash = $hashing-\u003emake($password);\n}\n```\n\n## Supported algorithm\nin this library three algorithm are supported\n- Bcrypt\n- Argon2I\n- Argon2ID\n\n### Switch between algorithm \n```php\n$hashing = new Hashing('supported-algorithm');\n$bvcryptHashing = new Hashing('bcrypt');\n```\n\n#### Default work factors\nYou can provide default work factors like\n```php\n\n//Argon2\n$argon2Hashing = new Hashing('argon2i',[\n    'memory' =\u003e 1024,\n    'time' =\u003e 2,\n    'threads' =\u003e 2,\n    'verify' =\u003e false,\n]);\n\n//Bcrypt\n$vcryptHashing = new Hashing('bcrypt'[\n    'cost' =\u003e 12,\n    'verify' =\u003e false,\n]);\n```\nhere verify option is additional indicate that if this set to true the algorithm is also sticky check on verify, if both algorithm are not matched then means password is not correct.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flablnet%2Fphp-hashing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flablnet%2Fphp-hashing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flablnet%2Fphp-hashing/lists"}