Download the PHP package tal7aouy/hashlib without Composer
On this page you can find all versions of the php package tal7aouy/hashlib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tal7aouy/hashlib
More information about tal7aouy/hashlib
Files in tal7aouy/hashlib
Package hashlib
Short Description Generates strong, secure passwords that are resistant to brute-force attacks.
License MIT
Informations about the package hashlib
HashLib
The HashLib
library provides a convenient and flexible way to generate, hash, and validate passwords with various
options and requirements. It includes a trait named Hasher
that defines password generation, validation, and
requirement checking functionalities.
Table of Contents
- Introduction
- Installation
- Usage
- Basic Hashing
- Hashing with Salt
- Password Requirement Checking
- Methods
- setLength
- setUseLowerCase
- setUseUpperCase
- setUseNumbers
- setUseSymbols
- setPasswordRequirements
- generateSalt
- isHashed
- hash
- verify
- hashWithSalt
- verifyWithSalt
- setPassword
- getPassword
- meetsRequirements
- Conclusion
Introduction
The HashLib
library is designed to simplify password hashing and verification in PHP applications. It offers a trait
called Hasher
that can be easily incorporated into your own classes to handle password-related operations.
Installation
The library can be installed using Composer:
Usage
Basic Hashing
Hashing with Salt
Password Requirement Checking
Methods
For a comprehensive list of methods and their descriptions, please refer to the full documentation.
Below is a quick overview of some of the key methods available in the HashLib
library:
setLength
Set the minimum required length for generated passwords.
setUseLowerCase
Specify whether lowercase letters are required in generated passwords.
setUseUpperCase
Specify whether uppercase letters are required in generated passwords.
setUseNumbers
Specify whether numbers are required in generated passwords.
setUseSymbols
Specify whether symbols are required in generated passwords.
setPasswordRequirements
Set multiple password requirements at once.
generateSalt
Generate a random salt using base64 encoding.
isHashed
Check if a password is already hashed.
hash
Hash a password using the specified algorithm and options.
verify
Verify if a password matches a given hash.
hashWithSalt
Hash a password with a randomly generated salt.
verifyWithSalt
Verify if a password, when combined with a salt, matches a given hash.
setPassword
Set the password to be used for hashing and validation.
getPassword
Get the currently set password.
meetsRequirements
Check if a given password meets the specified requirements.
For detailed usage instructions and examples, please see the Usage section above.
conclusion
Version: 1.0.0
License: MIT
For any questions, issues, or feedback, please reach out to the library's author, Mhammed Talhaouy.