相思资源网 Design By www.200059.com
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
/**
* 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 );
?>
标签:
加密解密
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无支持中文的php加密解密类代码的评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。