leigh/chacha20
最新稳定版本:0.2.0
Composer 安装命令:
composer require leigh/chacha20
包简介
Pure PHP implementation of the ChaCha20 encryption algorithm.
README 文档
README
This library contains a pure PHP implementation of the ChaCha20 encryption algorithm.
The library has been written to be high performance (relative to PHP), not pretty. It obviously doesn't perform anywhere close to a native implementation.
Usage:
Remember that a nonce must not be used more than once for a particular key
$chacha20 = new ChaCha20\Cipher;
$encCtx = $chacha20->init($key, $nonce);
$decCtx = $chacha20->init($key, $nonce);
$cipherText = $chacha20->encrypt($encCtx, $message);
$plainText = $chacha20->decrypt($decCtx, $cipherText);
The Context object maintains the current state of the algorithm, so that it can be used in a streaming scenario. Therefore an application performing simultaneous encryption and decryption will need to main two contexts.
The decrypt method is an alias of the encrypt method, and exists only to indicate intent.
Seek operations can be performed on the keystream by calling the setCounter method, where the count is in 64-byte blocks.
统计信息
- 总下载量: 8.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-12-14