Heim Backend-Entwicklung PHP-Tutorial 运用php screw进行源代码加密

运用php screw进行源代码加密

Jun 13, 2016 am 10:49 AM
compute nbsp php the

使用php screw进行源代码加密
网址
http://sourceforge.net/projects/php-screw/
我的安装环境
系统:Slackware 10
软件:Apache 1.3.31
PHP 4.3.7
以上环境全部是slackware 10默认安装后自带的。具体的Apache+php+mysql安装方法参照如下
支持php的Apache环境安装
获得软件
下载php_screw-1.3 (http://prdownloads.sourceforge.net/php-screw/php_screw-1.3.tgz?download)

安装
1.将获得的php_screw-1.3.tgz文件放到/usr/local目录下,然后用tar解压缩
tar zxvf php_screw-1.3.tgz

2.进入/usr/local/php_screw-1.3目录开始安装
1 cd /usr/local/php_screw-1.3
2 phpize
3 ./configure

3.设置自己用来加密的密码
vi my_screw.h

    -- Please change the encryption SEED key (pm9screw_mycryptkey) into the
      values according to what you like.
      The encryption will be harder to break, if you add more values to the
      encryption SEED array. However, the size of the SEED is unrelated to
      the time of the decrypt processing.

    * If you can read and understand the source code, to modify an original
      encryption logic will be possible. But in general, this should not
      be necessary.

    OPTIONAL: Encrypted scripts get a stamp added to the beginning of the
          file. If you like, you may change this stamp defined by
          PM9SCREW and PM9SCREW_LEN in php_screw.h. PM9SCREW_LEN must
          be less than or equal to the size of PM9SCREW.

4.编译
make

5.拷贝modules目录下的php_screw.so文件到/usr/lib/php/extension目录下
cp modules/php_screw.so /usr/lib/php/extension/

6.编辑php.ini文件
在php.ini文件里,加入如下语句
extension=php_screw.so

7.重新启动Apache
/etc/rc.d/rc.httpd restart

8.编译加密工具
cd tools
make

9.将tools目录下加密用的工具screw拷贝到适当目录
cp screw /usr/bin/

经过以上的10步,就已经把php_screw-1.3全部安装完成了。并且现在的php也已经支持解释加密过的php文件了
使用
1.现写一个要加密的php文件。
我写了如下的一个用来测试php速度的compute.php文件
01
02 $a=0;
03 $t=time();
04 for($i=0;$i05 {$a=$a*$i;}
06 $t1=time();
07 echo "

";
08 echo "It used:";
09 echo $t1-$t;
10 echo "seconds";
11 ?>

将上面的compute.php文件放到/var/www/htdocs目录下。通过浏览器访问,将显示出php在大量计算时的速度(只能粗略估计一下)
2.将我们写的php文件加密
cd /var/www/htdocs/
screw compute.php

我们加密后,现在目录下的compute.php文件就是我们已经加密的了。而源文件被改名为compute.php.screw存放了。
我们现在再测试一下compute.php,看看能否正常使用?速度如何?
我比较了一下,加密前后的速度大概一样,基本没有太多的损失。

Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn

Heiße Artikel -Tags

Notepad++7.3.1

Notepad++7.3.1

Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1

Senden Sie Studio 13.0.1

Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6

Dreamweaver CS6

Visuelle Webentwicklungstools

SublimeText3 Mac-Version

SublimeText3 Mac-Version

Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

PHP 8.4 Installations- und Upgrade-Anleitung für Ubuntu und Debian PHP 8.4 Installations- und Upgrade-Anleitung für Ubuntu und Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installations- und Upgrade-Anleitung für Ubuntu und Debian

CakePHP Datum und Uhrzeit CakePHP Datum und Uhrzeit Sep 10, 2024 pm 05:27 PM

CakePHP Datum und Uhrzeit

CakePHP-Datei hochladen CakePHP-Datei hochladen Sep 10, 2024 pm 05:27 PM

CakePHP-Datei hochladen

CakePHP-Routing CakePHP-Routing Sep 10, 2024 pm 05:25 PM

CakePHP-Routing

CakePHP-Projektkonfiguration CakePHP-Projektkonfiguration Sep 10, 2024 pm 05:25 PM

CakePHP-Projektkonfiguration

Besprechen Sie CakePHP Besprechen Sie CakePHP Sep 10, 2024 pm 05:28 PM

Besprechen Sie CakePHP

CakePHP-Kurzanleitung CakePHP-Kurzanleitung Sep 10, 2024 pm 05:27 PM

CakePHP-Kurzanleitung

So richten Sie Visual Studio-Code (VS-Code) für die PHP-Entwicklung ein So richten Sie Visual Studio-Code (VS-Code) für die PHP-Entwicklung ein Dec 20, 2024 am 11:31 AM

So richten Sie Visual Studio-Code (VS-Code) für die PHP-Entwicklung ein

See all articles