PHP¼ÓÃÜÀ©Õ¹¿âMcrypt°²×°¼°Ó¦Óü¼ÇÉ
PHP³ÌÐòÔ±ÃÇÔÚ±àд´úÂë³ÌÐòʱ£¬³ýÁËÒª±£Ö¤´úÂëµÄ¸ßÐÔÄÜÖ®Í⣬»¹ÓÐÒ»µãÊǷdz£ÖØÒªµÄ£¬ÄǾÍÊdzÌÐòµÄ°²È«ÐÔ±£ÕÏ¡£PHP³ýÁË×Ô´øµÄ¼¸ÖÖ¼ÓÃܺ¯ÊýÍ⣬»¹Óй¦ÄܸüÈ«ÃæµÄPHP¼ÓÃÜÀ©Õ¹¿âMcryptºÍMhash¡£
ÆäÖУ¬McryptÀ©Õ¹¿â¿ÉÒÔʵÏÖ¼ÓÃܽâÃܹ¦ÄÜ£¬¾ÍÊǼÈÄܽ«Ã÷ÎļÓÃÜ£¬Ò²¿ÉÒÔÃÜÎÄ»¹Ô¡£
1.PHP¼ÓÃÜÀ©Õ¹¿âMcrypt°²×°
ÔÚ±ê×¼µÄPHP°²×°¹ý³ÌÖв¢Ã»ÓаÑMrcypt°²×°ÉÏ£¬µ«PHPµÄÖ÷Ŀ¼Ï°üº¬ÁËlibmcrypt.dllºÍlibmhash.dllÎļþ (libmhash.dllÊÇMhashÀ©Õ¹¿â£¬ÕâÀï¿ÉÒÔÒ»Æð×°ÉÏ)¡£Ê×ÏÈ£¬½«ÕâÁ½¸öÎļþ¸´ÖƵ½ÏµÍ³Ä¿Â¼windows\system32Ï£¬È»ºóÔÚ PHP.iniÎļþÖа´Ctrl+F¿ì½Ý¼üÌø³ö²éÕÒ¿ò£¬²¢ÕÒµ½£»extension=php-mcrypt.dllºÍ; extension=php_mhash.dllÕâÁ½¸öÓï¾ä£¬½Ó׎«Ç°ÃæµÄ“£»”È¥µô£»×îºó£¬±£´æ²¢ÖØÆôApache·þÎñÆ÷¼´¿ÉÉúЧ¡£
2.PHP¼ÓÃÜÀ©Õ¹¿âMcryptµÄËã·¨ºÍ¼ÓÃÜģʽ
Mcrypt¿âÖ§³Ö20¶àÖÖ¼ÓÃÜËã·¨ºÍ8ÖÖ¼ÓÃÜģʽ£¬¾ßÌå¿ÉÒÔͨ¹ýº¯Êýmcrypt_list_algorithms()ºÍmcrypt_list_modes()À´ÏÔʾ£¬½á¹ûÈçÏ£º
McryptÖ§³ÖµÄËã·¨ÓУºcast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
McryptÖ§³ÖµÄ¼ÓÃÜģʽÓУºcbc cfb ctr ecb ncfb nofb ofb stream
ÕâЩËã·¨ºÍģʽÔÚÓ¦ÓÃÖÐÒªÒÔ³£Á¿À´±íʾ£¬Ð´µÄʱºò¼ÓÉÏǰ׺MCRYPT_ºÍMCRYPT_À´±íʾ£¬ÈçÏÂÃæMcryptÓ¦ÓõÄÀý×Ó£º
DESËã·¨±íʾΪMCRYPT_DES;
ECBģʽ±íʾΪMCRYPT_MODE_ECB£»
3.PHP¼ÓÃÜÀ©Õ¹¿âMcryptÓ¦ÓÃ
ÏÈ¿´Ò»¸öÀý×Ó£¬Á˽âMcryptµÄ¹¤×÷Á÷³Ì£¬ÔÙÀ´¿´¿´²¿·ÖÁ÷³ÌʹÓõĺ¯Êý£º
< ?php $str = "ÎÒµÄÃû×ÖÊÇ£¿Ò»°ãÈËÎÒ²»¸æËßËû£¡"; //¼ÓÃÜÄÚÈÝ $key = "key:111"; //ÃÜÔ¿ $cipher = MCRYPT_DES; //ÃÜÂëÀàÐÍ $modes = MCRYPT_MODE_ECB; //ÃÜÂëģʽ $iv = mcrypt_create_iv(mcrypt_get_iv_size($cipher,$modes),MCRYPT_RAND);//³õʼ»¯ÏòÁ¿ echo "¼ÓÃÜÃ÷ÎÄ£º".$str."<p>"; $str_encrypt = mcrypt_encrypt($cipher,$key,$str,$modes,$iv); //¼ÓÃܺ¯Êý echo "¼ÓÃÜÃÜÎÄ£º".$str_encrypt." <p>"; $str_decrypt = mcrypt_decrypt($cipher,$key,$str_encrypt,$modes,$iv); //½âÃܺ¯Êý echo "»¹Ô£º".$str_decrypt; ?>
ÔËÐнá¹û£º
¼ÓÃÜÃ÷ÎÄ£ºÎÒµÄÃû×ÖÊÇ£¿Ò»°ãÈËÎÒ²»¸æËßËû£¡
¼ÓÃÜÃÜÎÄ£º ï³盌?]鸴?q攦軄L Ц 郺葄"簻 Ɩ
Ïà¹ØÎĵµ£º
²é¿´ÍêÕû°æ±¾ : ¡¾Ô´´¡¿ÎÒÓÃphpдµÄ¶Ô³Æ¼ÓÃÜËã·¨£¬´ó¼Ò¿´¿´°²È«ÐÔÈçºÎ¡£
panic
2006-02-05, 22:37
//phpÒѾÓÐÁËÍêÕûµÄ¼ÓÃÜ/½âÃÜ¿âÖ§³Ö£¬µ«ÊÇÔÚһЩÖ÷»úÉÏ£¬ÕâЩ¿âûÓб»ÆôÓã¬ËùÒÔ³öÓÚÎÞÄΣ¬²ÅдÁËÏÂÃæµÄËã·¨¡£
//»ù±¾ÔÀíÊÇ£ºÓÃÃ÷ÎĵĺÍkeyµÄ×éºÏÉú³Écrc£¬È»ºóÓÃÕâ¸öcrcºÍkey×éºÏÉú³ÉÒ»¸öhashÑÚÂ룬ÓÃhashÑÚÂëºÍÃ÷ÎÄ ......
1¡¢Ç¶Èë·½·¨£º
ÀàËÆASPµÄ<%£¬PHP¿ÉÒÔÊÇ<?php»òÕßÊÇ<?£¬½áÊø·ûºÅÊÇ?>£¬µ±È»ÄúÒ²¿ÉÒÔ×Ô¼ºÖ¸¶¨¡£
2¡¢ÒýÓÃÎļþ£º
ÒýÓÃÎļþµÄ·½·¨ÓÐÁ½ÖÖ£ºrequire ¼° include¡£
require µÄʹÓ÷½·¨Èç require("MyRequireFile.php"); ¡£Õâ¸öº¯Êýͨ³£·ÅÔÚ PHP ³ÌÐòµÄ×îÇ°Ã棬PHP ³ÌÐòÔÚÖ´ÐÐÇ°£¬¾Í»áÏȶÁÈë require ËùÖ¸¶¨ÒýÈë ......
[Smarty - ¹Ù·½ÍøÕ¾]
http://smarty.php.net/
[Smarty - ÏÂÔصØÖ·]
µ±Ç°°æ±¾ 2.6.18, http://smarty.php.net/do_download.php?download_file=Smarty-2.6.18.tar.gz
È«²¿Áбí, http://smarty.php.net/download.php
[Smarty - Ïà¹ØÂÛ̳]
http://php.board.newsmth.net/
http://forum.c ......
ϸ²ì PHP V5.3.0 ÌØÐÔ
¼¶±ð£º Öм¶
Stephen B. Morris, CTO, Omey Communications
2009 Äê 12 ÔÂ 07 ÈÕ
Ëæ×ÅÁ÷ÐÐµÄ PHP ÓïÑԵIJ»¶ÏÑݱ䣬ºÜ¶àÐÂÌØÐÔʹËüÔÚÃæÏò¶ÔÏó·½ÃæÓÐÁ˽øÒ»²½µÄÔöÇ¿¡£±¾ÎÄͨ¹ýһЩ PHP V5.3 ʵÀýÑÝʾÑÓ³Ù¾²Ì¬°ó¶¨¡¢Ãû³Æ¿Õ¼äÖ§³Ö¡¢Àà·½·¨ÖØÔØÒÔ¼°±äÁ¿½âÎöºÍ heredoc Ö§³Ö¡£
ÐèÇó
³ýÁË¶Ô PHP ºÍ H ......
1£®Ç°ÑÔ
PHP £¨´Ó PHP 3.05
¿ªÊ¼£©Îª±£´æ¶ÔÏóÌṩÁËÒ»×éÐòÁл¯ºÍ·´ÐòÁл¯µÄº¯Êý£ºserialize¡¢unserialize¡£²»¹ýÔÚ PHP
ÊÖ²áÖжÔÕâÁ½¸öº¯ÊýµÄ˵Ã÷½öÏÞÓÚÈçºÎʹÓ㬶ø¶ÔÐòÁл¯½á¹ûµÄ¸ñʽȴû×öÈκÎ˵Ã÷¡£Òò´Ë£¬Õâ¶ÔÔÚÆäËûÓïÑÔÖÐʵÏÖ PHP
·½Ê½µÄÐòÁл¯À´Ëµ£¬¾Í±È½ÏÂé·³ÁË¡£ËäÈ»ÒÔÇ°Ò²ËѼ¯ÁËһЩÆäËûÓïÑÔʵÏÖµÄ PHP ÐòÁл¯µ ......