[李景山php]每天laravel-20160829|McryptEncrypter-3
来源:互联网 发布:刘国梁离任真相 知乎 编辑:程序博客网 时间:2024/05/24 06:33
/** * Run the mcrypt decryption routine for the value. * * @param string $value * @param string $iv * @return string * * @throws \Illuminate\Contracts\Encryption\DecryptException */ protected function mcryptDecrypt($value, $iv) { try { return mcrypt_decrypt($this->cipher, $this->key, $value, MCRYPT_MODE_CBC, $iv); } catch (Exception $e) { throw new DecryptException($e->getMessage()); } }//run function to decryption routine // this is a wrap about the mcrypt_decrypt /** * Add PKCS7 padding to a given value. * * @param string $value * @return string */ protected function addPadding($value) { $pad = $this->block - (strlen($value) % $this->block);// this is a number return $value.str_repeat(chr($pad), $pad);// get this wale repeat this }// bad pad function /** * Remove the padding from the given value. * * @param string $value * @return string */ protected function stripPadding($value) { $pad = ord($value[($len = strlen($value)) - 1]); return $this->paddingIsValid($pad, $value) ? substr($value, 0, $len - $pad) : $value; }// remove the padding from the given value. // check this value /** * Determine if the given padding for a value is valid. * * @param string $pad * @param string $value * @return bool */ protected function paddingIsValid($pad, $value) { $beforePad = strlen($value) - $pad; return substr($value, $beforePad) == str_repeat(substr($value, -1), $pad); }// check pad valid /** * Get the IV size for the cipher. * * @return int */ protected function getIvSize() { return mcrypt_get_iv_size($this->cipher, MCRYPT_MODE_CBC); }// get the iv size /** * Get the random data source available for the OS. * * @return int */ protected function getRandomizer()// get the random { if (defined('MCRYPT_DEV_URANDOM')) { return MCRYPT_DEV_URANDOM; } if (defined('MCRYPT_DEV_RANDOM')) { return MCRYPT_DEV_RANDOM; } mt_srand(); return MCRYPT_RAND; }}
0 0
- [李景山php]每天laravel-20160829|McryptEncrypter-3
- [李景山php]每天laravel-20160827|McryptEncrypter-1
- [李景山php]每天laravel-20160828|McryptEncrypter-2
- [李景山php]每天laravel-20160903|Dispatcher-3
- [李景山php]每天laravel-20160912|FileSystem-3
- [李景山php]每天laravel-20161003|Validator.php-3
- [李景山php]每天laravel-20161022|Request.php-3
- [李景山php]每天laravel-20161131|BelongsToMany.php-3
- [李景山php]每天laravel-20160922|RedisServicProvider.php
- [李景山php]每天laravel-20160923|Hub.php
- [李景山php]每天laravel-20160924|PiplineServiceProvider.php
- [李景山php]每天laravel-20160925|Pipeline.php
- [李景山php]每天laravel-20160926|DatabasePresenceVerifier.php
- [李景山php]每天laravel-20160927|Factory.php
- [李景山php]每天laravel-20160928|PresenceVerifierInterface.php
- [李景山php]每天laravel-20160929|ValidatesWhenResolved.php
- [李景山php]每天laravel-20160930|ValidationException.php
- [李景山php]每天laravel-20161001|ValidationServiceProvider.php
- Linux查看端口命令:netstat -tln
- IOS Dev Intro - Message Category and Protocol
- NPOI 将DataGridView导出到Excel
- ListView多条目展示
- cordova + ionic 使用中碰到的一些问题
- [李景山php]每天laravel-20160829|McryptEncrypter-3
- Android APK签名原理及方法
- Java基础03——位运算符
- Android 检测是否有ROOT权限
- Unity3D游戏开发之“unity3D命令行参数”
- CSDN的博客积分计算规则及博客排名规则
- linux下定时器struct itimerval的使用
- oracle导入dmp备份文件
- BeanUtil里利用反射来写增、删、改、查