开始之前,首先要澄清两个问题:第一,支持开源,不等于反对代码加密;第二,如果把不属于自己的东西(比如公司的)拿去开源,就更加不应该了。
以前知道的,PHP代码的加密都是用Zend的encoder,这东西不但是商业软件,好像还暴出过能够被破解的问题,所以就找到了替代的方案────php_screw,一个日本人开发的东东。
php_screw非常小巧,没有仔细看过它的算法,但从说明文档中看,可以自行更改SEED,然后自行编译so和可执行档。如果够牛的话,甚至可以自己去更改算法。不管怎样,对于我们这些"普通人"来说,这种加密应该就够了吧,如果真想滴水不漏,那还是不要公开的好,虽然作者说的并不是很容易就破解,但指不定哪儿有牛群呢不是么?
安装的环境需要:PHP5.x,zlib开启,autoconf,automake已安装。
测试环境:Ubuntu 8.04 hardy, PHP 5.2.3。
1、 解压,更改my_screw.h,里面的几个数字就是SEED,相当于密码,可以随意更改、增加,并且数字的多少不影响解密的速度。
2、编译so文件:
$ phpize $ ./configure $ make 如果出现这样的错误,那是因为autoconf没有安装:
$ make make: *** No targets specified and no makefile found. Stop. 3、安装so文件,编译好的文件在modules目录下,将其拷贝到php extension存放的位置,比如/usr/lib/php5/20060613+lfs下,然后在php.ini中增加:
extension = php_screw.so 4、编译用来加密文件的可执行文件:
$ cd tools $ make tools目录下新生成的screw就是了,放到$PATH中就可以调用了,比如要加密一个文件:
$ screw a.php Success Crypting(a.php) 加密后的a.php执行正常,同时screw还会把原来没有加密的文件改名为.screw文件作为备份。
Related posts
- 选择Eclipse PHP Development Tools(PDT)作为PHP开发工具 (5)
- 让phpmailer支持中文名称的附件 (0)
- 终于能够通过phpmailer使用gmail账号发送邮件了 (45)
- 由一个错误学到的一些php安全配置问题 (2)
- 忙碌的5月 (8)
![[Bloglines]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/bloglines.png)
![[co.mments]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/comments.png)
![[del.icio.us]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/digg.png)
![[diigo]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/diigo.png)
![[Facebook]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/facebook.png)
![[Furl]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/furl.png)
![[Google]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/google.png)
![[MySpace]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/myspace.png)
![[Reddit]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/reddit.png)
![[Rojo]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/rojo.png)
![[Slashdot]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/slashdot.png)
![[StumbleUpon]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/technorati.png)
![[Windows Live]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/email.png)