dupkey / token
Standardize token generation along with converting to and from string (hex) to binary along with hashing.
Installs: 117
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/dupkey/token
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^6.3
This package is not auto-updated.
Last update: 2020-10-21 18:13:34 UTC
README
Token generation, conversion and hashing. Convert to and from string (hexadecimal) or binary.
Installation
composer require dupkey/token
Usage Examples
Generate a new Token.
$token = new Token(int $length = 16);
Get the hexadecimal string of the generated token.
string $token->toString();
(string) $token;
Get the sha512 hash of the token
string $token->getHash();
Create a new Token from a hexadecimal representation.
$token = (new Token)->fromString(string $token);