https://github.com/srph/jelai.php-hashing
jelai.php Hashing abstraction
https://github.com/srph/jelai.php-hashing
Last synced: about 1 month ago
JSON representation
jelai.php Hashing abstraction
- Host: GitHub
- URL: https://github.com/srph/jelai.php-hashing
- Owner: srph
- License: mit
- Created: 2015-02-25T08:01:09.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-27T03:23:18.000Z (over 11 years ago)
- Last Synced: 2025-09-01T06:15:49.059Z (10 months ago)
- Language: PHP
- Size: 223 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jelai.php-hashing
jelai.php Hashing abstraction
## What is jelai.php?
Please see this [gist](https://gist.github.com/srph/2e2d51d46dadfdbc38e3).
## Usage
The package provides a built-in for *md5*.
```php
require __DIR__ . '/path/to/src/SRPH/Jelai/Hashing/MD5Hasher.php';
$hasher = new SRPH\Jelai\Hashing\MD5Hasher;
$hasher->make('123'); // '202cb962ac59075b964b07152d234b70'
$hasher->check('123', '202cb962ac59075b964b07152d234b70') // true
```
The abstraction simply provides an interface (```HashingInterface```).
```php
app->bind('SRPH\Jelai\Hashing\HashingInterface', 'MyApp\Hashing\BycryptHasher');
}
}
```
\* *This hashing abstraction is mostly a mimic of Laravel's hashing abstraction.*
## API
#### ```HashingInterface```
The interface requires to have methods ```make``` and ```check```.
- ```make``` (```$value```, *```array```* ```$options```);
Hash the provided value.
```returns```: ```string``` (the hashed value).
- ```check``` (```$value```, ```$hashedValue```, *```array```* ```$options```)
Checks if the provided *value* and *hashed value* (```$hashedValue```) is equal.
```returns```: ```boolean``
\* *Check the example, [MD5Hasher](https://github.com/srph/jelai.php-hashing/blob/master/src/SRPH/Jelai/Hashing/MD5Hasher.php).*
## Acknowledgement
**jelai.php-hashing** © 2015+, Kier Borromeo (srph). **jelai.php** is released under the [MIT](mit-license.org) license.
> [srph.github.io](http://srph.github.io) ·
> GitHub [@srph](https://github.com/srph) ·
> Twitter [@_srph](https://twitter.com/_srph)