ride/lib-encryption
最新稳定版本:1.1.0
Composer 安装命令:
composer require ride/lib-encryption
包简介
Encryption library of the Ride framework
README 文档
README
Encryption library of the PHP Ride framework.
What's In This Library
Cipher
The Cipher interface is used to implement a cipher to encrypt and decrypt data using an encryption key.
Available implementations:
- ride\library\encryption\cipher\ChainCipher: Chain of ciphers with an certain amount of iterations
- ride\library\encryption\cipher\GenericCipher: Generic implementation
- ride\library\encryption\cipher\SimpleCipher: Simple implementation with relative short length of encrypted data, not secure for sensitive data
Hash
The Hash interface is used to implement cryptographic hash algorithms. These are methods which take an arbitrary block of data and return a fixed-size bit string
Available implementations:
- ride\library\encryption\hash\GenericHash: Use installed hash functions, defaults to SHA256
- ride\library\encryption\hash\PlainHash: For testing purposes
Code Sample
Check this code sample to see the possibilities of this library:
<?php use ride\library\encryption\cipher\GenericCipher; use ride\library\encryption\exception\EncryptionException; use ride\library\encryption\hash\GenericHash; // cipher to encrypt and decrypt data try { $cipher = new GenericCiper(); $data = "Top secret mission"; // if you don't have a secret key, you can generate one $key = $cipher->generateKey(); $encrypted = $cipher->encrypt($data, $key); $decrypted = $cipher->decrypt($encrypted, $key); } catch (EncryptionException $exception) { // something's up! } // hash to generate a code of fixed size, good for passwords $hash = new GenericHash(); $data = $hash->hash($data);
Installation
You can use Composer to install this library.
composer require ride/lib-encryption
统计信息
- 总下载量: 5.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-02-21