gpt4 book ai didi

支持中文的php加密解密类代码

转载 作者:qq735679552 更新时间:2022-09-29 22:32:09 25 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章支持中文的php加密解密类代码由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

php代码类:  。

复制代码代码如下

<?php  /**  * 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 <string, boolean>  */  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 <string, boolean>  */  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';  }  ?>  。

使用方法:  。

复制代码代码如下

<?php //Code Start  /**  * 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:" . $a, "<br />";  echo "DeCode:" . MD5Crypt::Decrypt ( $a, 100 );  ?>  。

最后此篇关于支持中文的php加密解密类代码的文章就讲到这里了,如果你想了解更多关于支持中文的php加密解密类代码的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com