php对称加密算法的例子_PHP教程
程序员文章站
2023-12-31 19:42:46
...
分享下php对称加密算法的实现代码。
KEY 是之前定义的常量
Mcrypt::::('ROOT') or ('Access Denied' encrypt( (mcrypt_encrypt(MCRYPT_RIJNDAEL_256, (), , MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), decrypt( mcrypt_decrypt(MCRYPT_RIJNDAEL_256, (), (), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB),
xcrypt.php
__construct(, = 'cbc', = "off" (( 8:
->mcrypt = 16:
->mcrypt = 32:
->mcrypt =:
("Key size must be 8/16/32".jbxue.-> = (( 'ofb':
->mode = ( == 'off') ('OFB must give a IV');
'cfb':
->mode = ( == 'off') ('CFB must give a IV');
'ecb':
->mode = = 'off';
'cbc':
:
->mode = (( "off":
->iv = "auto":
= =='WINNT' ? MCRYPT_RAND :->iv = mcrypt_create_iv(mcrypt_get_block_size(->mcrypt, ->mode), :
->iv = www.jbxue. getIV( = 'base64' ( 'base64':
= (-> 'hex':
= (-> 'bin':
:
= ->
encrypt(, = 'base64' (->mcrypt == MCRYPT_DES) = ->_pkcs5Pad( ((-> = mcrypt_encrypt(->mcrypt, ->, , ->mode, -> = mcrypt_encrypt(->mcrypt, ->, , -> ( 'base64':
= ( 'hex':
= ( 'bin':
:
=
decrypt(, = "base64" = ( 'base64':
= ( 'hex':
= ->_hex2bin( 'bin':
: ( !== ((->
推荐阅读
-
php对称加密算法的例子_PHP教程
-
php实现字符串反转输出的方法_PHP教程
-
PHP中类的继承和用法实例分析,php实例分析_PHP教程
-
PHP实现通过中文字符比率来判断垃圾评论的方法,_PHP教程
-
PHP explode()函数的几个应用和implode()函数有什么区别,explodeimplode_PHP教程
-
网友原创的PHP模板类代码_PHP教程
-
PHP与正则表达系列之一: PHP中的正则表达式_PHP教程
-
关于php,mysql,html的数字分页和文本分页的两种分页样式供大家参考_PHP教程
-
phpExcel导出大量数据出现内存溢出错误的解决方法_PHP教程
-
php微信开发之批量生成带参数的二维码,php批量参数_PHP教程