[李景山php]每天laravel-20160827|McryptEncrypter-1
2016-06-12 09:10
591 查看
namespace Illuminate\Encryption; use Exception; use RuntimeException; use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\EncryptException; use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract; /** * @deprecated since version 5.1. Use Illuminate\Encryption\Encrypter. */ class McryptEncrypter extends BaseEncrypter implements EncrypterContract {// use Mcrypt Encrypter extends baseEncrypter /** * The algorithm used for encryption. * * @var string */ protected $cipher;// this is a algorithm used for encryption /** * The block size of the cipher. * * @var int */ protected $block;// block size about cipher /** * Create a new encrypter instance. * * @param string $key * @param string $cipher * @return void * * @throws \RuntimeException */ public function __construct($key, $cipher = MCRYPT_RIJNDAEL_128) { $key = (string) $key;// use parameter is key and cipher [algorithm] if (static::supported($key, $cipher)) { $this->key = $key;// key $this->cipher = $cipher;// cipher $this->block = mcrypt_get_iv_size($this->cipher, MCRYPT_MODE_CBC);// get the block } else { throw new RuntimeException('The only supported ciphers are MCRYPT_RIJNDAEL_128 and MCRYPT_RIJNDAEL_256.'); }// if wrong throw error }
相关文章推荐
- 最新最全PHP生成制作验证码代码详解(推荐)
- 再谈PHP中单双引号的区别详解
- yii2实战教程之新手入门指南-简单博客管理系统
- php中heredoc与nowdoc的使用方法
- PhpMyAdmin 配置文件现在需要一个短语密码的解决方法
- [李景山php]每天laravel-20160826|EncryptionServiceProvider
- [李景山php]每天laravel-20160826|EncryptionServiceProvider
- ftp文件操作
- js解析php数组
- PHP读取XML文件数据
- php学习笔记之事务处理
- 再谈PHP中单双引号的区别详解
- 最新最全PHP生成制作验证码代码详解(推荐)
- 详解PHP中cookie和session的区别及cookie和session用法小结
- php gd等比例缩放压缩图片函数
- PHP生成制作验证码的简单实例
- PhpMyAdmin 配置文件现在需要一个短语密码的解决方法
- php常用函数
- 阅读鸟哥的风雪之隅PHP博客的笔记(1)
- 15个实用的PHP正则表达式