Browsing all articles tagged with 加密
8
6

忘记md5(),sha1()等加密方法吧..

Author Jessica     Category PHP     Tags , , ,

这篇文章又严重的不严谨性.这个结果在现在看来是无效的.

大家就当看看儿戏吧..我就不删除了.

详情请查看hash()为什么比md5()要快?(已过时)

很多人都不知道PHP有个函数叫做hash() 也能实现md5等加密.

我们来试试它的速度如何.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$time=microtime(1);
for ($i=0;$i<100000;$i++)
   hash('md5', 'string');
echo microtime(1)-$time,': hash/md5';
 
$time=microtime(1);
for ($i=0;$i<100000;$i++)
   md5('string');
echo microtime(1)-$time,': md5';
 
$time=microtime(1);
for ($i=0;$i<100000;$i++)
   hash('sha1', 'string');
echo microtime(1)-$time,': hash/sha1';
 
$time=microtime(1);
for ($i=0;$i<100000;$i++)
   sha1('string');
echo microtime(1)-$time,': sha1';
 
$time=microtime(1);
for ($i=0;$i<100000;$i++)
   hash('md5', $i);
echo microtime(1)-$time,': hash/md5';
 
$time=microtime(1);
for ($i=0;$i<100000;$i++)
   md5($i);
echo microtime(1)-$time,': md5';
 
$time=microtime(1);
for ($i=0;$i<100000;$i++)
   hash('sha1', $i);
echo microtime(1)-$time,': hash/sha1';
 
$time=microtime(1);
for ($i=0;$i<100000;$i++)
   sha1($i);
echo microtime(1)-$time,': sha1';

read more

5
2

一个加密/解密类..

Author Jessica     Category PHP, 收集整理     Tags , ,

由于这个类知道的人不多.所以暂时还是很安全的:)

  1. class Crypt{  
  2.  
  3.     protected $key;  
  4.  
  5.     public function __construct($key){  
  6.  
  7.         $this->key = $key;  
  8.  
  9.     }  
  10.  
  11.     public function decode($data){  
  12.  
  13.         for($k = $this->key, $i = -1, $l = strlen($data); ++$i < $l ;) {  
  14.  
  15.             $data[$i] = chr(ord($data[$i]) ^ ($k >> 8));  
  16.  
  17.             $k = (int)((ord($data[$i]) + $k) * 52845 + 22719);  
  18.  
  19.         }  
  20.  
  21.         return $data;  
  22.  
  23.     }  
  24.  
  25.     public function encode($data){  
  26.  
  27.         for($k = $this->key, $r = $data$i = -1, $l = strlen($r); ++$i < $l ;) {  
  28.  
  29.             $r[$i] = chr(ord($data[$i]) ^ ($k >> 8));  
  30.  
  31.             $k = (int)((ord($data[$i]) + $k) * 52845 + 22719);  
  32.  
  33.         }  
  34.  
  35.         return $r;  
  36.  
  37.     }  
  38.  
18
0

codelock encode & decode

Author Jessica     Category PHP, 收集整理     Tags , , ,

codelock是PHP加密的一种方式..但是属于弱加密.很好破解…= =||

所以把encode和decode都一起发上来吧.经过codelock加密后的代码如图所示那样.

基于base64的

read more

分类目录

最近文章

最近评论

文章索引模板

标签

.net AJAX button Comet CSS Discuz! DIV+CSS Flash Form Google HTML编辑器 IE8 Java JavaScript jQuery JSP md5 MySQLReback Oracle PHP php-fpm PNG Punny SkiyoTabs tab TagCloud Vista Web2.0 Windows7 上传 加密 变量 图标 本站原创 模板 模板引擎 源码 登录 短网址 石家庄 算法 编译 面向对象 魔术方法

链接表