<无详细内容>
- /**
- * Copyright (c) 2011-01 XatuDream
- * XatuDream All Rights Reserved.
- * Support: 185390516.qzone.qq.com
- * QQ: 185390516
- * Author: Lau Version: 1.01
- * Date: 2010-08-12 09:28:32
- */
- ! Defined ('workspace ') & exit ("Access Denied! ");
- Class MD5Crypt {
- /**
- * Enter description here...
- * @ Param unknown_type $ str
- * @ Return string
- */
- Public final static function mdsha ($ str ){
- $ Code = substr (md5 ($ str), 10 );
- $ Code. = substr (sha1 ($ str), 0, 28 );
- $ Code. = substr (md5 ($ str), 0, 22 );
- $ Code. = substr (sha1 ($ str), 16). md5 ($ str );
- Return self: chkToken ()? $ Code: null;
- }
- /**
- * Enter description here...
- * @ Param unknown_type $ param
- */
- Private final static function chkToken (){
- Return true;
- }
- /**
- * Enter description here...
- * @ Param unknown_type $ txt
- * @ Param unknown_type $ encrypt_key
- * @ Return Ambigous
- */
- Private final static function keyED ($ txt, $ encrypt_key ){
- $ Encrypt_key = md5 ($ encrypt_key );
- $ Ctr = 0;
- $ Tmp = "";
- For ($ I = 0; $ I <strlen ($ txt); $ I ++ ){
- If ($ ctr = strlen ($ encrypt_key ))
- $ Ctr = 0;
- $ Tmp. = substr ($ txt, $ I, 1) ^ substr ($ encrypt_key, $ ctr, 1 );
- $ Ctr ++;
- }
- Return $ tmp;
- }
- /**
- * Enter description here...
- * @ Param unknown_type $ txt
- * @ Param unknown_type $ key
- * @ Return string
- */
- Public final static function Encrypt ($ txt, $ key ){
- Srand (double) microtime () * 1000000 );
- $ Encrypt_key = md5 (rand (0, 32000 ));
- $ Ctr = 0;
- $ Tmp = "";
- For ($ I = 0; $ I <strlen ($ txt); $ I ++ ){
- If ($ ctr = strlen ($ encrypt_key ))
- $ Ctr = 0;
- $ Tmp. = substr ($ encrypt_key, $ ctr, 1). (substr ($ txt, $ I, 1) ^ substr ($ encrypt_key, $ ctr, 1 ));
- $ Ctr ++;
- }
- $ _ Code = md5 ($ encrypt_key). base64_encode (self: keyED ($ tmp, $ key). md5 ($ encrypt_key. $ key );
- Return self: chkToken ()? $ _ Code: null;
- }
- /**
- * Enter description here...
- * @ Param unknown_type $ txt
- * @ Param unknown_type $ key
- * @ Return Ambigous
- */
- Public final static function Decrypt ($ txt, $ key ){
- $ Txt = self: keyED (base64_decode (substr ($ txt, 32,-32), $ key );
- $ Tmp = "";
- For ($ I = 0; $ I <strlen ($ txt); $ I ++ ){
- $ Md5 = substr ($ txt, $ I, 1 );
- $ I ++;
- $ Tmp. = (substr ($ txt, $ I, 1) ^ $ md5 );
- }
- Return self: chkToken ()? $ Tmp: null;
- }
- /**
- * Enter description here...
- * @ Var unknown_type
- */
- Private static $ _ key = 'lau ';
- }
- ?>
- Usage:
- /**
- * Copyright (c) 2011 XatuDream
- * XatuDream All Rights Reserved.
- * Support: 185390516.qzone.qq.com
- * QQ: 185390516
- * Author: LoveCrystal Version: 1.01
- * Date: 2011-9-2 04:00:37
- */
- Define ('workspace ','. '. DIRECTORY_SEPARATOR );
- Header ("Content-Type: text/html; charset = utf-8 ");
- Include_once 'core/Library/MD5Crypt. class. php ';
- $ A = MD5Crypt: Encrypt ("A", 100 );
- Echo "EnCode:". $ ,"
";
- Echo "DeCode:". MD5Crypt: Decrypt ($ a, 100 );
- ?>
|