ÎÒÓÃphpдµÄ¶Ô³Æ¼ÓÃÜËã·¨
²é¿´ÍêÕû°æ±¾ : ¡¾Ô´´¡¿ÎÒÓÃphpдµÄ¶Ô³Æ¼ÓÃÜËã·¨£¬´ó¼Ò¿´¿´°²È«ÐÔÈçºÎ¡£
panic
2006-02-05, 22:37
//phpÒѾÓÐÁËÍêÕûµÄ¼ÓÃÜ/½âÃÜ¿âÖ§³Ö£¬µ«ÊÇÔÚһЩÖ÷»úÉÏ£¬ÕâЩ¿âûÓб»ÆôÓã¬ËùÒÔ³öÓÚÎÞÄΣ¬²ÅдÁËÏÂÃæµÄËã·¨¡£
//»ù±¾ÔÀíÊÇ£ºÓÃÃ÷ÎĵĺÍkeyµÄ×éºÏÉú³Écrc£¬È»ºóÓÃÕâ¸öcrcºÍkey×éºÏÉú³ÉÒ»¸öhashÑÚÂ룬ÓÃhashÑÚÂëºÍÃ÷ÎÄÒì»ò£¬µÃµ½ÃÜÎÄ¡£
//crc×÷ΪÃÜÎĵÄÒ»²¿·Öͬʱ·Ö·¢¡£
//¸öÈËÈÏΪËã·¨µÄÆƽâµÄÄѶÈÔÚÓÚ£º
//crcºÍhashËã·¨¶¼ÊÇÄÑÒÔÇóÄæµÄ£¬¼´Ê¹crcÒѾ¹«¿ª£¬ÏëÒª¹¹ÔìÒ»¸ö·ûºÏÕâ¸öcrcµÄ´®ÄѶȼ«¸ß£¨ÒòΪcrcÊÇ´®ºÍkeyÁ¬½ÓÖ®ºóÇóµÃµÄ¡£
//hashÑÚÂëËæÃ÷Îı仯²¨¶¯¾çÁÒ£¬Á½×鲻ͬµÄÃ÷ÎÄÄÑÒÔ·¢ÉúÅöײ¡£
//ȱµãÊDz»ÄܶԺܳ¤µÄÃ÷ÎÄ×ö¼ÓÃÜ£¬Ö»ÒªÃ÷Îij¤¶È³¬¹ýhashÑÚÂëµÄ³¤¶È£¬ÄæÍƳöÑÚÂëµÄ¿ÉÄÜÐԾͻá´ó´óÔö¼Ó¡£
//ÁíÍâÒ»µ©·¢ÉúcrcÅöײ£¬ÄǾͺÜÈÝÒ×Æƽâ³öÏàͬcrcµÄËùÓÐÃ÷ÎÄ£¬Õâ¸öÎÒÔÚ¿¼ÂÇÊÇ·ñ¿ÉÒÔͨ¹ýÔö¼Ócrc³¤¶ÈµÈ·½Ê½½â¾ö¡£
//Õâ¸ö¼ÓÃÜËã·¨Ö»ÓÐÁ½¸ö¼òµ¥µÄÄ¿µÄ£º
//1£¬±ÜÃâÒÑÖª¶à×éÃÜÎÄÍƵ¼³ökey
//2£¬±ÜÃâÒÑÖª¶à×éÃÜÎÄ£¬ÔÚ²»ÖªkeyµÄÇé¿öÏÂαÔìÃÜÎÄ
//ÏÂÃæ´úÂëÖÐÓÐЩº¯ÊýÊÇÎÒ×Ô¼ºÐ´µÄ£¬¹¦ÄÜ˵Ã÷ÈçÏ£º
//stringxor£¬°ÑÁ½¸östringµÄÔªËØÒì»ò£¬²»×㳤¶ÈµÄ´Ó0¿ªÊ¼Ñ»·¡£
//string2int/int2string£¬ÔÚintÖµºÍstringÖ®¼äת»¯¡£
//ÒÔÏÂÊÇ´úÂë¡£
<?php
function encrypt_hash_crc($txt,$key,$hash_func = 'md5',$crc_func = 'crc32')
{
$crc = intval( $crc_func($txt.$key) );
$hash = $hash_func($crc.$key);
//Éú³ÉÖмä½á¹ûtemp
$tmp = stringxor($txt,$hash);
//Ìí¼Ó$crcµ½Í·²¿
$result = int2string($crc).$tmp;
return $result;
}
function decrypt_hash_crc($txt,$key,$hash_func = 'md5',$crc_func = 'crc32')
{
$tmp = $txt ;
//È»ºóÌáÈ¡crc£¬Ç°4¸ö×Ö½ÚÊÇCRC
$crc = string2int(substr($tmp,0,4));
$hash = $hash_func($crc.$key);
//ÌáÈ¡txt
$txt = substr($tmp,4);
//×îºó½âÃÜ
$tmp = stringxor($txt,$hash);
return $tmp;
}
?>
cnbragon
2006-02-06, 02:05
°´ÕÕÄãµÄÒâ˼µÃµ½ÈçϵÄʽ×Ó
CRC32(PlainText+Key)=str_crc
MD5(str_crc+Key)^PlainText=CipherText
¿´¿´Á¬Á¢ºóµÃµ½ÁËʲô£¿
CRC32(MD5(str_crc+Key)^CipherText+Key)=str_crc
ºÇºÇ£¬Ö»Ê£ÏÂÒ»¸öKeyÁË£¬Ð¡ÐÄÓÐÈË»¨·ÑÐÄ˼ȥÇî¾ÙÕâ¸öKeyŶ£¬Key¿ÉÒª±£¹ÜºÃ:D:
panic
2006-02-06, 09:16
ºÇºÇ£¬Èç¹ûË㷨ûÎÊÌâ£
Ïà¹ØÎĵµ£º
×î½üÒ»Ö±ÔÚ×ö×Ô¼ºµÄͼÊéÕ¾£¬·Ö±ðʹÓùý½ÜÆæºÍ¶Á°ÉÁ½Ìײ»Í¬µÄϵͳ£¬¶ÔÓÚÕâÁ½Ì×ϵͳҲÊÇÓÖ°®ÓÖºÞ£¬°®µÄÊÇËûÃǵŦÄÜÇ¿´ó£¬ºÞËûÃǶ¼Í¬ÊôûÓпªÔ´¾«ÉñµÄ²úÎï¡£ºÇºÇ£¬×÷ΪһÃûÇî³ÌÐòÔ±£¬°³¿ÉÒÔÀí½â×÷ÕߵĿàÖÔ£¬ÕâÀï¾Í²»ÅúÅÐÁË¡£
Äê¼ÙÆڼ䣬ÎÞÊ¿É×ö£¬·¿´×Ô¼ºÒÔÇ°µÄ²É¼¯´úÂ룬·¢Ïֺܶà¿ÉÒÔÓÅ»¯ºÍÌáÉýµÄµØ·½£¬¾Í¼òµ¥×öÁËÏÂÓÅ» ......
ÔÚѧϰphpʱ£¬¿´µ½µÄ£¬×ö¸ö±Ê¼Ç
×Ö·û´®Í·²¿£º^
<?php echo ereg(“^hello”,”hello world!”); ?>
×Ö·û´®Î²²¿£º$
<?php echo ereg(“bye$”,”goodbye”); ?>
ÈÎÒâµÄµ¥¸ö×Ö·û£º.
<?php echo ereg(“.”,”goodbye”); ......
PHPÊÇʹÓÃ×îΪ¹ã·ºµÄ¿ªÔ´·þÎñÆ÷¶Ë½Å±¾ÓïÑÔÖ®Ò»£¬µ±È»PHP²¢
²»ÊÇËÙ¶È×î¿ì
µÄ£¬µ«ËüÈ´ÊÇ
×î³£ÓõĽű¾ÓïÑÔ
¡£ÕâÀïÓÐ50¸öÓÐÒæµÄPHP¹¤¾ß£¬¿ÉÒÔ´ó´óÌá¸ßÄãµÄ±à³Ì¹¤×÷£º
µ÷ÊÔ¹¤¾ß
Webgrind
Xdebug
Gubed PHP Debugger
DBG
PHP_Debug
PHP_Dyn
MacGDBp
²âÊÔºÍÓÅ»¯¹¤¾ß
PHPUnit
SimpleTest
......
ÔÚphpÖмÆËãʱ¼ä²îÓÐʱºòÊǼþÂé·³µÄÊÂ!²»¹ýÖ»ÒªÄãÕÆÎÕÁËÈÕÆÚʱ¼äº¯ÊýµÄÓ÷¨ÄÇÕâЩҲ¾Í±äµÄ¼òµ¥ÁË:
Ò»¸ö¼òµ¥µÄÀý×Ó¾ÍÊǼÆËã½èÊéµÄÌìÊý,ÕâÐèÒªphp¸ù¾ÝÿÌìµÄÈÕÆÚ½øÐмÆËã,ÏÂÃæ¾ÍÀ´Ì¸Ì¸ÊµÏÖÕâÖÖÈÕÆÚ¼ÆËãµÄ¼¸ÖÖ·½·¨:
(1) Èç¹ûÓÐÊý¾Ý¿â¾ÍºÜÈÝÒ×ÁË!ÈôÊÇMSSQL¿ÉÒÔʹÓô¥·¢Æ÷!ÓÃרÃżÆËãÈÕÆÚ²îµÄº¯Êýdatediff()±ã¿É ......