arzzen/php-time-lock-encryption
最新稳定版本:1.1.0
Composer 安装命令:
composer require arzzen/php-time-lock-encryption
包简介
Time Lock Encryption Class
README 文档
README
Implementation of timed-release crypto.
This class can encrypt data using key generated for a time period.
It takes an expression that defines a given time period and generates a key by creating iteratively hashes of the initial key in a cycle until the specified time as passed.
The class returns the encrypted data using the Fernet class with the generated key.
It can also decrypt previously encrypted data by regenerating the encryption key the same number of iterations that it were used to generate the key when the data was encrypted.
Requirements
- PHP 5.3.3 or later
- hash extension
- openssl or mcrypt extension
Installation
You can install this library by using [Composer]. You can also view more info about this on [Packagist].
Add this to the require section in your composer.json file.
{
"require": {
"arzzen/php-time-lock-encryption": "1.1.*"
}
}
Usage
<?php use TimeLockCrypt; $timeLock = new TimeLockCrypt('keyseed'); $message = 'secret message'; $encrypted = $timeLock->encrypt('+10 second', $message); $iterations = $timeLock->getIterations(); $decrypted = $timeLock->decrypt($encrypted, $iterations); var_dump($message == $decrypted); ?>
统计信息
- 总下载量: 156
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-12-21