devtoolboxuk/hashing
Composer 安装命令:
composer require devtoolboxuk/hashing
包简介
Hashing Package
README 文档
README
Hashing Service
Table of Contents
Background
Although there are many hashing services out there, I decided to create a basic one for use on some of my projects.
The Unit Tests have been run on PHP 5.4 and 7.2. This is to help support legacy projects.
Usage
Usage of the hashing service
$ composer require devtoolboxuk/Hashing
Then include Composer's generated vendor/autoload.php to enable autoloading:
require 'vendor/autoload.php';
use devtoolboxuk/Hashing; $this->hashingService = new HashingService();
Set Hashing Key
$this->hashingService->setHashingKey($key);
Get Hashing key
$this->hashingKey = $this->hashingService->getHashingKey();
Hashing Data
Pass in the data to be hashed.
$this->hashingService->hash("Test Data");
Get Hashed Data
Returns the hash of the data.
$this->hashingService->getHashedData()
By default, the Hashing service uses the SHA256 Algoritm, and the HMAC Hashing Function
Retrieve Hashed Data
$this->hashingService->setHashingKey($key); $this->hashingKey = $this->hashingService->getHashingKey();
The algorithm for hashing can be changed using this function, currently only the following algorithms are supported; 'sha256', 'sha384', 'sha512', 'md5'
Set Algorithm
$this->hashingService->setHashingKey($key); $this->hashingKey = $this->hashingService->getHashingKey();
The hashing function can also be changed to use either hmac or not (others may come along...)
Set Hashing Function
$this->hashingService->setHashFunction('hmac');
Maintainers
License
MIT © DevToolboxUK
统计信息
- 总下载量: 390
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-11