PHP基于md5生成短HASH的代码
PHP基于md5生成短HASH的代码 ```{.php}/********** CHash provides users with a fairly strong but short hash for identification* Based on MD5**********/class stdHash{var $hashIn = #39;#39;;function __construct($hashIn=#39;
/*********
* CHash provides users with a fairly strong but short hash for identification
* Based on MD5
**********/
class stdHash{
var $hashIn = '';
function __construct($hashIn=''){
$this->hashIn = $hashIn;
}
function hash($string){
$cherryTable = Array('0'=>0,'1'=>1,'2'=>2,'3'=>3,'4'=>4,'5'=>5,'6'=>6,'7'=>7,'8'=>8,'9'=>9,'A'=>10,'B'=>11,'C'=>12,'D'=>13,'E'=>14,'F'=>15);
$md = md5($string.$this->hashIn);$m="";
for($i=0;$i<16;$i++){
$m.=chr($cherryTable[$md[$i*2]]*16 + $cherryTable[$md[$i*2+1]]);
}
return preg_replace('~[N=]~','',str_rot13(base64_encode($m)));
}
}
- 上一篇:php获得随机颜色的代码
- 下一篇:php生成图片缩略图代码类
精彩图集
精彩文章






