zeyon/cryptastic
最新稳定版本:1.0
Composer 安装命令:
composer require zeyon/cryptastic
包简介
PHP Encryption / Decryption Using the MCrypt Library.
README 文档
README
THIS IS A MODIFIED VERSION OF THE cryptastic CLASS by Andrew Johnson
The original code can be found at the following URL
http://www.itnewb.com/v/PHP-Encryption-Decryption-Using-the-MCrypt-Library-libmcrypt
Example
$pass = 'the password'; $salt = 'the password salt'; $msg = 'This is the secret message.'; /**********************************************************************************************************************/ // EXAMPLE #1 USING STRING AS MESSAGE $cryptastic = new cryptastic; $key = $cryptastic->pbkdf2($pass, $salt, 1000, 32) or die("Failed to generate secret key."); $encrypted = $cryptastic->encrypt($msg, $key) or die("Failed to complete encryption."); $decrypted = $cryptastic->decrypt($encrypted, $key) or die("Failed to complete decryption"); echo $decrypted . "<br /><br />\n"; /**********************************************************************************************************************/ // EXAMPLE #2 USING ARRAY AS MESSAGE $msg = array('message' => $msg); $encrypted = $cryptastic->encrypt($msg, $key); $decrypted = $cryptastic->decrypt($encrypted, $key); echo $decrypted['message'];
统计信息
- 总下载量: 1.89k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL
- 更新时间: 2014-10-17