[李景山php]每天laravel-20160827|McryptEncrypter-1

来源:互联网 发布:52单片机引脚功能 编辑:程序博客网 时间:2024/05/21 22:52
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    }
0 0
原创粉丝点击